list_filter doesn't appear for model with ForeignKey to auth.models.User
Hi all,
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
--
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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home