Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#14707 closed (fixed)

Allow an annotation to match a field name when using .values on a query set.

Reported by: Andy McKay Owned by:
Component: Database layer (models, ORM) Version: 1.3-alpha
Severity: Keywords: blocker, regression
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

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.

Change History (6)

comment:1 by Russell Keith-Magee, 14 years ago

Component: UncategorizedORM aggregation
milestone: 1.3
Owner: nobody removed
Triage Stage: UnreviewedAccepted

This is a regression in trunk, so it needs to be on the 1.3 milestone.

comment:2 by Russell Keith-Magee, 14 years ago

Keywords: blocker regression added

comment:3 by Russell Keith-Magee, 14 years ago

Resolution: fixed
Status: newclosed

(In [15223]) Fixed #14707 -- Relax the protections on aggregate naming collisions when a ValuesQuerySet removes the colliding name. Thanks to Andy McKay for the report.

comment:4 by Russell Keith-Magee, 14 years ago

(In [15224]) [1.2.X] Fixed #14707 -- Relax the protections on aggregate naming collisions when a ValuesQuerySet removes the colliding name. Thanks to Andy McKay for the report.

Backport of r15223 from trunk.

comment:5 by Jacob, 13 years ago

milestone: 1.3

Milestone 1.3 deleted

comment:6 by Anssi Kääriäinen, 12 years ago

Component: ORM aggregationDatabase layer (models, ORM)
Note: See TracTickets for help on using tickets.
Back to Top