Hello,
I'm using list_editable of a ModelAdmin to allow users change a choicefield
right in the changelist view.
Ex:
I've a list
*Field1 Field2 ChoiceField*
abc def foo
ghj klm bar
The idea is that ChoiceField is filled according to the *field1 *and *field2
*values, so the values filled in "foo" choicefield can be different than in
"bar" choicefield.
But to filter this field this way I need to know some field values of the
instance I'm pointing.
I'd tried to implement:
def formfield_for_foreignkey(self, db_field, request=None, **kwargs):
if db_field.name == 'my_field':
kwargs['queryset'] = MyNewFiltter
MyNewFilter is a filter based on fields values of the instance itself
But it seems that the formfield_for_foreignkey is not created for a
specific instance, so I've no access to instance fields, is there some way
to do what I'm thinking about in Admin? If you've any other suggestions to
do that please let me know.
Best Regards,
--
Daniel França,
about.me/danielfranca
--
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.