Wednesday, February 29, 2012

Keeping filters when adding in the admin interface

Hello, if I have the following Model:

class A:
name

class B:
name
a = models.ForeignKey(A)

class C:
name
b = models.ForeignKey(B)

And let's suppose that in the Admin Site I have a Filter in the C list
that refers to the A model. Is there a way to keep that filter when I
am going to add a new C object and use it to filter the combobox of
the b filed so that it will only show the b objects that are related
to the A model in the filter?
For example:
If the filter I choose points to the id=1 in the A model, the combobox
for the b field when I add a C object only has to show the B objects
that has a = 1

Is there a way to do this?
Thanks a lot for the help.
Greetings.
Mauro.

--
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.

No comments:

Post a Comment