You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-filter
I'm using Django filters in a project but I'm suprised by the out-of-
the-box behavior with regard to choices.
A model with field 'state' that uses the USStateField, I create a
FilterSet on this model and specify fields ['state'] and nothing else.
What I'm left with is a form that gives me a dropdown box with no
'------' option! Inspecting with pdb, I find that the field is
required = False.
Is this expected behavior? Could such a shockingly basic bug exist in
django-filters or have I missed something?
Strangely, when I create a FilterSet and I specify the fields manually
(field = django_filters.SomeFilter(...)) the choices are as expected.
Sergiy Kuzmenko
unread,
Apr 28, 2011, 1:17:34 PM4/28/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
That's a known bug. I have submitted a pull request[1] that fixes this problem awhile ago but it hasn't been acknowledged yet.
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django-filter
Sorry, could you link me to the commit that achives it?
Sergiy Kuzmenko
unread,
May 8, 2011, 9:46:50 PM5/8/11
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
Maybe I read your message too quickly. I saw you were having trouble with USStateField. When I had to use django_filters for one of my project I realized that it only worked with filters defined in django.db.models [1]. Any other field inheriting would be excluded [2]. As my project had a number of non-standard fields, I put a quick patch to address that. It allows to django_filter to generate filters for any field inheriting from those defined in django.db.models (and that would include USStateField).