Apparently, Adrian doesn't think it should work with anything but DB fields http://code.djangoproject.com/ticket/2334 Crap!
On May 29, 1:49 pm, Peter Bengtsson <pete...@gmail.com> wrote: > When I register my model to the admin it doesn't allow me to use a > method in list_filter :( > This pseudo code should explain my situation: > > class MyModel: > gender = models.CharField() > age = models.IntegerField() > > �...@property > def man(self): > return self.gender == 'male' and self.age > 18 > > objects = SpecialManager() > > The special manager I use makes it possible to do this:>>> > MyModel.objects.filter(man=True) > > I achived that by wrapping filter() and exclude(). No big deal. > The admin is registered like this: > > class MyModelAdmin(admin.ModelAdmin): > list_display = ('__unicode__', 'user', 'man') > list_filter = ('man', ) # thise causes the ImproperlyConfigured > error! > > def man(self, object_): > return object_.man > man.short_description = 'Man?' > man.allow_tags = False > > admin.site.register(MyModel, MyModelAdmin) > > Why can't I use methods instead of fields in list_filter? > Is there a solution to this problem? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---