On Nov 20, 12:33 pm, "Dominic Ashton" <[EMAIL PROTECTED]>
wrote:
> Guys,
>
> A brief google search has led me to conclude that it's not possible to
> filter on a foreign key field in the Admin.
>
> Can anyone explain the design rationale around that? Filtering by anything
> but a foreign key value is usuless in many of my models. To give you a
> concrete example: I have a Products model, with one to many links to:
> Suppliers and categories. Without being able to filter by supplier or
> category i'm left being able to filter by product name, price or product
> number. This is next to useless.
>
> I'm sure i'm missing something obvious here, so I'd really appreciate it if
> somebody could point me to a resource by which I could cure my ignorance.
>
> Cheers,

Don't know why you think you can't filter on a ForeignKey. The
documentation says this:

Set list_filter to activate filters in the right sidebar of the change
list page of the admin. This should be a list of field names, and each
specified field should be either a BooleanField, CharField, DateField,
DateTimeField, IntegerField or ForeignKey.

http://docs.djangoproject.com/en/dev/ref/contrib/admin/#list-filter

There's a whole class in django.contrib.admin.filterspecs devoted to
filtering on related items.
--
DR.
--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to