Opened 6 years ago

Closed 6 years ago

Last modified 4 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: UI/UX:

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 Changed 6 years ago by Russell Keith-Magee

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

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

comment:2 Changed 6 years ago by Russell Keith-Magee

Keywords: blocker regression added

comment:3 Changed 6 years ago by Russell Keith-Magee

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 Changed 6 years ago by Russell Keith-Magee

(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 Changed 5 years ago by Jacob

milestone: 1.3

Milestone 1.3 deleted

comment:6 Changed 4 years ago by Anssi Kääriäinen

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