diff options
| author | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-02-29 15:53:25 +0000 |
|---|---|---|
| committer | Malcolm Tredinnick <malcolm.tredinnick@gmail.com> | 2008-02-29 15:53:25 +0000 |
| commit | 2f8f588df1f200f14d8c93414aad1411d0624315 (patch) | |
| tree | 4735e1720dbb5c1fad1131ca5a26814c594681cf /tests | |
| parent | fa11a6a128886860d969c1b0315893948c062425 (diff) | |
queryset-refactor: Made update() work with inherited models.
git-svn-id: http://code.djangoproject.com/svn/django/branches/queryset-refactor@7179 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/modeltests/model_inheritance/models.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/modeltests/model_inheritance/models.py b/tests/modeltests/model_inheritance/models.py index fb4aad4016..988edefa9c 100644 --- a/tests/modeltests/model_inheritance/models.py +++ b/tests/modeltests/model_inheritance/models.py @@ -216,5 +216,13 @@ DoesNotExist: Restaurant matching query does not exist. >>> Restaurant.objects.get(lot__name='Well Lit') <Restaurant: Ristorante Miron the restaurant> +# The update() command can update fields in parent and child classes at once +# (although it executed multiple SQL queries to do so). +>>> Restaurant.objects.filter(serves_hot_dogs=True, name__contains='D').update(name='Demon Puppies', serves_hot_dogs=False) +>>> r1 = Restaurant.objects.get(pk=r.pk) +>>> r1.serves_hot_dogs == False +True +>>> r1.name +u'Demon Puppies' """} |
