Opened 6 years ago

Closed 6 years ago

#15028 closed (worksforme)

1.2.4 breaks queryset.extra(select={'__double_underscore_field': ...})

Reported by: cdestigter Owned by: nobody
Component: Database layer (models, ORM) Version: 1.2
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:


In 1.2.3 this worked fine:

qs = qs.extra(select={'__foo': "1"}).order_by('__foo')

Now in 1.2.4 I get:

FieldError at /test/
Cannot resolve keyword '' into field. Choices are [...]

I believe the solution is to change django/db/models/sql/

pieces = name.split(LOOKUP_SEP)


pieces = filter(None, name.split(LOOKUP_SEP))

Change History (3)

comment:1 Changed 6 years ago by cdestigter

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

Actually.. that solution is munted since it strips off the underscores :(

Perhaps a regex fix?

We've already worked around this with s/foo/_foo/ ...

comment:2 Changed 6 years ago by cdestigter

  • Has patch unset
  • Patch needs improvement set

comment:3 Changed 6 years ago by russellm

  • Resolution set to worksforme
  • Status changed from new to closed

I can't reproduce this problem on 1.2.3, 1.2.4 or trunk. If you can provide a more complete example that fails, feel free to reopen.

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