#25306: Should be an easier way to restrict the choices for a ForeignKey
-------------------------------+--------------------------------------
Reporter: CuriousG102 | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 1.8
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by CuriousG102):
Thanks for the pointer Tim! I've been digging into the admin code, because
I honestly hadn't needed to before. I'm sure that what you mentioned will
end up being what I have to do. But part of the point of Django admin
seems to be that people don't end up having to dive into the code for an
admin interface when they're building a website. Hence why there are
options like blank and limit_choices_to on fields. The suggestion in this
feature request is that model fields have something similar to
limit_choices_to. Perhaps this parameter could be passed a function. When
a ForeignKey is populated in a change view, this function could be passed
the relevant instance, and could return a queryset to filter on.
--
Ticket URL: <https://code.djangoproject.com/ticket/25306#comment:2>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/069.0af2f69efb2177d147ee3b47f22d4c89%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.