How to prevent duplicates when using ModelChoiceFilter the Django Filter way

35 views
Skip to first unread message

Raf Rasenberg

unread,
Apr 24, 2019, 2:56:34 PM4/24/19
to django-filter
Hello Django Filter Ninja's,

I posted a full question on StackOverflow about Django Filter in combination with a Orderable model and Wagtail. If someone could help me out I would be so thankfull!!


The solution should be something like this (I think):
I basically have one `FieldPosition` object per page-field position, so it's listing all of the objects correctly. I suspect I should not use the model chooser there, but a list of the hard coded values in `FIELD_POSITION_CHOICES` and then a  filter to execute a query that looks something like `PlayerDetailPage.objects.filter(field_position_relationship__field_position=str_field_position_choice)`.

I would love to see what is the right way by using Django Filters.

Thanks in advance.

Regards,

Raf
Reply all
Reply to author
Forward
0 new messages