developing my app with Django 1.2.1 and having completed large parts of
the main functionality already, I've now started with familiarizing
myself with user authentication.
I understand that django.contrib.auth.models.User is best extended as
described at
<http://docs.djangoproject.com/en/1.2/topics/auth/#storing-additional-information-about-users>,
but I also want to associate users with some of my regular models. For
example:
> from django.db import models
> from django.contrib.auth.models import User
>
> class Department(models.Model):
> benutzer = models.ManyToManyField(User)
>
> class Team(models.Model):
> head = models.ForeignKey(User)
Unfortunately, with this admin.py
> class DepAdmin(admin.ModelAdmin):
> list_filter = ['benutzer']
>
> admin.site.register(Department, DepAdmin)
>
> class TeamAdmin(admin.ModelAdmin):
> list_filter = ['head']
>
> admin.site.register(Team, TeamAdmin)
none of the two list filters appears in the side bar (other filters that
are similar but whose "target" model is not User work fine).
Thus, my question is, is there something about model "User" that
prevents it from being used with list_filter?
What can I do to have "Departments" and "Teams" filtered by "User"?
Best regards,
Carsten
--
Cafu - the open-source Game and Graphics Engine
for multiplayer, cross-platform, real-time 3D Action
Learn more at http://www.cafu.de
Found the problem:
When there is only one element in a table (one user in User), the
list_filter is not displayed - adding a second user fixed the problem.
Sorry for the noise!
Best regards,
Carsten