#14707: Allow an annotation to match a field name when using .values on a query
set.
---------------------------+------------------------------------------------
Reporter: andymckay | Owner: nobody
Status: new | Milestone:
Component: Uncategorized | Version: 1.3-alpha
Keywords: | Stage: Unreviewed
Has_patch: 0 |
---------------------------+------------------------------------------------
Ticket http://code.djangoproject.com/ticket/11256 has the unfortunate
effect of stopping a values query from working.
{{{
class Author(models.Model):
last_updated = models.DateField()
class Book(models.Model):
author = models.ForeignKey(Author, related_name='books')
pubdate = models.DateField()
}}}
{{{
authors =
Author.objects.values("id").annotate(last_updated=Max('books__pubdate'))
}}}
In this case we are using values to only use that one field and
last_updated is no longer overriding anything.
--
Ticket URL: <http://code.djangoproject.com/ticket/14707>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.