#32170: Admin select_related is different to the model's select related
-----------------------------------------+------------------------
Reporter: Michael | Owner: nobody
Type: Uncategorized | Status: new
Component: Uncategorized | Version: 3.1
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
In a model one can do `.select_related('foo__bar')`.
However in the admin view if one has `select_related = ('foo__bar', )` it
raises the error `Non-relational field given in select_related: 'bar'.
Choices are: ...`. One has to do `select_related = ('foo', )`. Hence to
select only certain fields, one has to override the `get_queryset`.
Seems a bit inconsistent? I guess it goes hand in hand with not allowing
foreign key fields in list display (#5863) etc.
--
Ticket URL: <https://code.djangoproject.com/ticket/32170>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/053.1693e24db02f4c1bc60d3b90baa914dc%40djangoproject.com.