Nothing about this? :(
I can't put a field came from a foreignkey in a list_filter..
If someone can help..
On Thu, Nov 13, 2008 at 11:52 AM, caio ariede <[EMAIL PROTECTED]> wrote:
> Hello.
>
> I'm trying to put a field came from a foreignkey in admin list_filter.
>
> My model is something like this:
>
> class UserProfile(models.Model):
>
> user = models.ForeignKey(User, unique=True)
>
> state = models.CharField(max_length = 2, choices = STATE_CHOICES)
> city = models.CharField(max_length = 200)
>
> in the admin:
>
> class UserProfileAdmin(admin.ModelAdmin):
>
> form = UserProfileAdminForm
>
> def user(obj): return obj.user
> def is_staff(obj): return obj.user.is_staff
> ....
>
> list_display = (user, email, first_name, last_name, is_staff, date_joined)
> list_filter = ('is_staff',)
>
>
> Look that list_display works fine, but I can't put 'is_staff' in
> list_filter, in Django 0.96 I think the method use 2 underscores,
> myfk__myfield (user__myfield), but now it doesn't work.
>
> How can I do?
>
> Thanks in advance.
>
> --
> Caio Ariede
> http://caioariede.com/
>
--
Caio Ariede
http://caioariede.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---