Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#27800 closed Bug (fixed)

Crash with QuerySet.annotate(Length(...)).distinct()

Reported by: Lex Berezhny Owned by: nobody
Component: Database layer (models, ORM) Version: 1.11
Severity: Release blocker Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

After 3b2db6ec12ce7d4b32f60dd7713e5f23cac498b7, this query for test/annotations/ crashes with AttributeError: 'IntegerField' object has no attribute 'model'.

Employee.objects.annotate(
    name_len=Length('first_name'),
).distinct('name_len').values_list('name_len', flat=True)

PR

Change History (2)

comment:1 by Tim Graham <timograham@…>, 8 years ago

Resolution: fixed
Status: newclosed

In ac5f886c:

Fixed #27800 -- Fixed QuerySet.annotate(Length(...)).distinct() crash.

comment:2 by Tim Graham <timograham@…>, 8 years ago

In d43f8478:

[1.11.x] Fixed #27800 -- Fixed QuerySet.annotate(Length(...)).distinct() crash.

Backport of ac5f886c5610a6bca26dab10170b445d1e9df450 from master

Note: See TracTickets for help on using tickets.
Back to Top