#14580: Cleaning up duplicate code in the admin, add get_formsets_instances
-------------------------------------------+--------------------------------
          Reporter:  apollo13              |         Owner:  nobody
            Status:  new                   |     Milestone:  1.3   
         Component:  django.contrib.admin  |       Version:  SVN   
        Resolution:                        |      Keywords:        
             Stage:  Unreviewed            |     Has_patch:  1     
        Needs_docs:  0                     |   Needs_tests:  0     
Needs_better_patch:  0                     |  
-------------------------------------------+--------------------------------
Comment (by apollo13):

 Hmm, I uploaded a new page which returns formsets and inlines instead of
 the admin_inlines. I am still not really happy with it though. Especially
 since I am running into this problem now:

 {{{
     def get_formset_instances(self, request, obj, change):
         f, i = super(RecipeAdmin, self).get_formset_instances(request,
 obj, change)
         return [f[0]], [i[0]]
 }}}

 That's a naive example for dropping inlines, but shows my problem… I have
 two inlines on the page and drop the second, this is fine, until I send a
 POST request. the super call instantiates the form and can't find the
 management data (obviously cause it's not there) before I get a chance to
 drop it. I am beginning to think that we shouldn't return the instances
 but the formclasses + inlines. (And maybe clean up the code by using an
 _construct_formsets function). Note: I am aware of the fact, that I could
 just c&p the code from get_formset_instances into my admin and modify it
 as needed, but that's not really nice… Any ideas?

-- 
Ticket URL: <http://code.djangoproject.com/ticket/14580#comment:2>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to