Blogger Template by Blogcrowds.

change the default filter choice from 'ALL'

class MyModelAdmin(admin.ModelAdmin):

    def changelist_view(self, request, extra_context=None):
        if not request.GET.has_key('decommissioned__exact'):
            q = request.GET.copy()
            q['decommissioned__exact'] = 'N'
            request.GET = q
            request.META['QUERY_STRING'] = request.GET.urlencode()
         return super(MyModelAdmin,self).changelist_view(request, extra_context=extra_context)


0 Comments:

Post a Comment



Newer Post Older Post Home