#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 julien):

 In theory, I think the proper way would be to do:

 {{{#!python
 class ResAdminListFilter(SimpleListFilter):
     title = 'Multiple Status'

     parameter_name = "status"  # Do not put double underscores in here

     def lookups(self, request, model_admin):
         return (
             ('0,30,40', _('All but BN')),
             ('200,300', _('Only BN')),
         )
     def queryset(self, request, queryset): # Write the code below (instead
 of just "pass")
         statuses = self.value().split(',')
         return queryset.filter(status__in=statuses)
 }}}

 {{{#!python
 class ResAdmin(MultilingualAdminMixin, ResAdminMixin, ModelAdminDMY):
     list_filter = ('supplier', 'created', ResAdminListFilter, )  # Same as
 before but without 'status'
     ...
 }}}

 Could you try that and see if that works?

-- 
Ticket URL: <https://code.djangoproject.com/ticket/17091#comment:9>
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