Opened 9 years ago

Closed 9 years ago

#15028 closed (worksforme)

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

Reported by: Craig de Stigter 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: no UI/UX: no


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 9 years ago by Craig de Stigter

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 9 years ago by Craig de Stigter

Has patch: unset
Patch needs improvement: set

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

Resolution: worksforme
Status: newclosed

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