Changes between Initial Version and Version 1 of Ticket #25306, comment 2


Ignore:
Timestamp:
Aug 24, 2015, 2:51:46 PM (9 years ago)
Author:
Miles Hutson

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #25306, comment 2

    initial v1  
    11Thanks 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.
     2
     3Perhaps this could be done by adding the behavior described to limit_choices_to? I believe this would involve modifying the __init__ method of forms.models.BaseModelForm
Back to Top