------------
models.py
class Accounts(models.Model):
enabled = Models.BooleanField()
balance = Models.DecimalField()
def __str__(self):
return self.enabled
class User(models.Model)
name = Models.TextField()
accounts = Models.ForeignKey(Accounts)
--------------------
admin.py
class UserAdmin(admin.ModelAdmin):
list_filter = [ 'name', 'accounts']
--------------------------------
-------------------------------
Above is my code. In the admin page, I see User model, but in filter
option for accounts to the right, the boolean repeats itself. so if I
have 20 accounts, I see 20 true/false on the right side bar. Is there
a way to filter on a foreign key field? I am trying to filter user
objects based on accounts foreign key field. Thanks for looking.
saeb
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---