#15494: Using only('pk') in related set raises FieldDoesNotExist
------------------------------------------+---------------------------------
Reporter: anonymous | Owner: nobody
Status: new | Milestone:
Component: Database layer (models, ORM) | Version: 1.2
Keywords: | Triage Stage: Unreviewed
Has patch: 1 |
------------------------------------------+---------------------------------
This is my first ticket, apologies if this is known or I've missed
something in my report.
With model A and model B, where model B has a fk to A:
>>> A().b_set.all().only('pk')
Raises "FieldDoesNotExist: B has no field named 'pk'"
In my example I'm instantiating a new object for brevity. The behaviour
is the same with a saved object.
I've attached a simple patch, however I couldn't get the testrunner
working, so I couldn't write a full patch. Also, I expect this isn't the
best method, but I don't know enough about the ORM to know of a better
fix.
--
Ticket URL: <http://code.djangoproject.com/ticket/15494>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.