On Mon, Oct 25, 2010 at 5:01 AM, Florian Apolloner <f.apollo...@gmail.com> wrote: > Hi, > > in one of my projects I would like to alter the inlines in the admin > on a per request basis. So I though I could use get_formsets to drop > unneeded inlines; this isn't the case :( get_formsets has to return > the same inlines in the correct order (eg > http://code.djangoproject.com/browser/django/trunk/django/contrib/admin/options.py#L789 > requires this). Maybe we could add a method like > get_formsets_with_inlines (better name anyone) which (by default) > would just return zip(self.get_formsets(request), > self.inline_instances). This would increase the usefulness of > get_formsets quite a bit imo. Any thoughts?
Sounds like a reasonable idea in general. However, get_formsets_with_inlines strikes me as exposing a little too much of the internal implementation. Having a quick look at the code, it strikes me that the actual use case here is 'get_formset_instances()' -- the prefixing and formset instantiation logic is essentially shared between the three places that get_formsets() are used, and would provide the entry point that you need to eliminate formsets on a per-request basis. I'd be a lot more comfortable with an API at than one that provides 'zip some stuff together' level functionality. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-develop...@googlegroups.com. To unsubscribe from this group, send email to django-developers+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-developers?hl=en.