I'm using the very cool django-filter (via: 
http://github.com/alex/django-filter)
and either can't seem to wrap my head around the docs, or maybe just
need a little boost.

When I show the filter form on an object list page, for a FK field I
get the dropdown that includes a "-----" which kind of results in an
"any" type filter. But I have some choices set to a field on that
model, and I'd like to get the same "any" type option, but I don't.

Here's a relevant example portion from models.py:


---

TICKET_STATUS_CHOICES = (
    ('new', 'New'),
    ('accepted', 'Accepted'),
    ('assigned', 'Assigned'),
    ('reopened', 'Reopened'),
    ('closed', 'Closed'),
)

class Ticket(models.Model):
    assigned_to = models.ForeignKey(User, null=True, blank=True)
    status = models.CharField(max_length=20,
choices=TICKET_STATUS_CHOICES, default='new')

import django_filters

class TicketFilter(django_filters.FilterSet):
    class Meta:
        model = Ticket
        fields = ['assigned_to', 'status']

------

When I display the filter form, 'assigned_to' gets an 'any' option, as
well as listing the available users. The 'status' field, however, is
limited to only the options listed in the actual '_CHOICES'.

How do I add an 'any' option to the fields based on _CHOICES?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to