#17091: Djano 1.4 SimpleListFilter 'selected' option issue
-------------------------------------+-------------------------------------
     Reporter:  tejinderss@…         |                    Owner:  nobody
         Type:  Bug                  |                   Status:  new
    Component:  contrib.admin        |                  Version:  SVN
     Severity:  Normal               |               Resolution:
     Keywords:  SimpleListFilter,    |             Triage Stage:  Design
  FilterSpec                         |  decision needed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------

Comment (by anonymous):

 Ok this thing worked:

     def queryset(self, request, queryset):
         if self.value() == 'nobn':
             return queryset.filter(status__in=(0, 30, 40))
         if self.value() == 'bn':
             return queryset.filter(status__in=(200, 300))

 Alternatively i also tried overriding the value() method in my custom
 filter like this:

     def value(self): #Bug fix, passing '30,40' changes to list and it does
 not match the params val
         val = self.params.get(self.parameter_name, None)
         if isinstance(val, str):
             return val
         if isinstance(val, list):
             return ','.join(val)


 Maybe we can add this feature? But i guess the first approach is better.
 Thanks for the help. I guess this ticket is closed now.

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17091#comment:11>
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 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-updates?hl=en.

Reply via email to