Changes between Initial Version and Version 1 of Ticket #5833, comment 68
- Timestamp:
- Aug 29, 2011, 10:01:22 AM (13 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #5833, comment 68
initial v1 11 11 from django.utils.datastructures import SortedDict 12 12 13 class How YummyFilterSpec(FilterSpec):13 class HowTastyFilterSpec(FilterSpec): 14 14 def __init__(self, request, params, model, model_admin): 15 15 super(HowYummyFilterSpec, self).__init__(request, params, model, model_admin) 16 16 self.links = SortedDict(( 17 17 ('All', 'all'), 18 (' Double Rainbow', 'so_intense'),18 ('Super good', 'super_good'), 19 19 ('Pretty good', 'good'), 20 20 ('Not great', 'not_great'), … … 33 33 34 34 def get_query_set(self, cls, qs): 35 if self.params.has_key('s o_intense'):35 if self.params.has_key('super_good'): 36 36 return qs.filter(name__icontains='bacon') 37 37 if self.params.has_key('good'): … … 45 45 46 46 def title(self): 47 return u'How yummy?'47 return u'How tasty?' 48 48 49 49 class FoodAdmin(admin.ModelAdmin): 50 list_filter = [How YummyFilterSpec]50 list_filter = [HowTastyFilterSpec] 51 51 52 52 admin.site.register(models.Food, FoodAdmin)