@@ -0,0 +1,1933 @@
+from datetime import date%0A%0Afrom django.contrib import admin%0Afrom django.utils.translation import ugettext_lazy as _%0A%0Aclass PhotoSizeFilter(admin.SimpleListFilter):%0A    # Human-readable title which will be displayed in the%0A    # right admin sidebar just above the filter options.%0A    title = _('By file size')%0A%0A    # Parameter for the filter that will be used in the URL query.%0A    parameter_name = 'size'%0A%0A    def lookups(self, request, model_admin):%0A        %22%22%22%0A        Returns a list of tuples. The first element in each%0A        tuple is the coded value for the option that will%0A        appear in the URL query. The second element is the%0A        human-readable name for the option that will appear%0A        in the right sidebar.%0A        %22%22%22%0A        return (%0A            ('small', _('%3C= 1 MB')),%0A            ('medium', _('%3C= 10 MB')),%0A            ('large', _('%3C= 100 MB')),%0A            ('xlarge', _('%3E 100 MB')),%0A        )%0A%0A    def queryset(self, request, queryset):%0A        %22%22%22%0A        Returns the filtered queryset based on the value%0A        provided in the query string and retrievable via%0A        %60self.value()%60.%0A        %22%22%22%0A        # Compare the requested value (either '80s' or '90s')%0A        # to decide how to filter the queryset.%0A        if self.value() == 'small':%0A            return queryset.filter(birthday__gte=date(1980, 1, 1),%0A                                    birthday__lte=date(1989, 12, 31))%0A        if self.value() == 'medium':%0A            return queryset.filter(birthday__gte=date(1990, 1, 1),%0A                                    birthday__lte=date(1999, 12, 31))%0A        if self.value() == 'large':%0A            return queryset.filter(birthday__gte=date(1980, 1, 1),%0A                                    birthday__lte=date(1989, 12, 31))%0A        if self.value() == 'xlarge':%0A            return queryset.filter(birthday__gte=date(1990, 1, 1),%0A                                    birthday__lte=date(1999, 12, 31))%0A

initialize custom size filter.