Changes between Initial Version and Version 1 of Ticket #5833, comment 68


Ignore:
Timestamp:
Aug 29, 2011, 10:01:22 AM (13 years ago)
Author:
Ben Davis

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #5833, comment 68

    initial v1  
    1111from django.utils.datastructures import SortedDict
    1212
    13 class HowYummyFilterSpec(FilterSpec):
     13class HowTastyFilterSpec(FilterSpec):
    1414    def __init__(self, request, params, model, model_admin):
    1515        super(HowYummyFilterSpec, self).__init__(request, params, model, model_admin)
    1616        self.links = SortedDict((
    1717            ('All', 'all'),
    18             ('Double Rainbow', 'so_intense'),
     18            ('Super good', 'super_good'),
    1919            ('Pretty good', 'good'),
    2020            ('Not great', 'not_great'),
     
    3333   
    3434    def get_query_set(self, cls, qs):
    35         if self.params.has_key('so_intense'):
     35        if self.params.has_key('super_good'):
    3636            return qs.filter(name__icontains='bacon')
    3737        if self.params.has_key('good'):
     
    4545   
    4646    def title(self):
    47         return u'How yummy?'
     47        return u'How tasty?'
    4848
    4949class FoodAdmin(admin.ModelAdmin):
    50     list_filter = [HowYummyFilterSpec]
     50    list_filter = [HowTastyFilterSpec]
    5151
    5252admin.site.register(models.Food, FoodAdmin)
Back to Top