> Hello,
> I have three models
> X
> Lang
> Y
> where the purpose of Y is to provide X fields in other languages.
> So I have Y as
> Y
> x foreignkey on X
> lang ForeignKey on Lang
> additionalfields...
>
> I have created the ModelAdmin for Lang. For X I have the ModelAdmin and
> added the
> inlines = [
> YInline,
> ]
>
> So far so good: I have the form of X with inlines for Y with a dropdown on
> languages.
> Now I have extended the user profile as documented in django docs. I have
> succesfully overriden the queryset method ot he LangModelAdmin so to filter
> on some user profile additinal information.
> The problem is that I can not filter the inlines; i.e. I want that every
> user has its owns languages and thus I want to see in X form the language
> dropdown filled with only certain languages. Instead all languages are
> listed there.
> I have searched a bit and it seems a common problem,but without solution.
> Am I missing something simple?
> Thanks
>
As far as I can remember there is no method to overide on admin inline
class in order to queryset filtering. But admin inline classes
provides a form attribut that let you to specify what form to use, so
I think the way to go is providing a custom inline form that performs
the queryset filtering, just like this:
http://stackoverflow.com/questions/2581049/filter-queryset-in-django-inlineformset-factory
--
Marc
--
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