> > My problem is that 'department' in list_display works just great, > > while in list_filter in makes an error: > > Request Method: GET > > Request URL: http://127.0.0.1:8000/admin/unitmanager/unit/ > > Exception Type: FieldDoesNotExist > > Exception Value: name=branch > > Exception Location: c:\program > > files\python24\lib\site-packages\django-0.91-py2.4.egg\django\db\models\options.py > > in get_field, line 97 > This is kind of hidden, but it is in the documentation: list_display can > take functions (and also properties), whereas list_filter can only take > fields from your model. "Department" is not a field, it's essentially a > function call (disguised as an attribute reference). The reason for > this is that the fields in list_filter are used directly in an SQL > statement used to query the database, so we cannot have Python code at > that level.
Thanks for the answer. Si there any neat trick to circunvent this limitation? Maybe by doing an sql view? Thanks, G --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---