#10305: contrib/admin/options.py add_view, change_view
----------------------------------------------+-----------------------------
 Reporter:  ctao                              |       Owner:  nobody    
   Status:  new                               |   Milestone:  post-1.0  
Component:  django.contrib.admin              |     Version:  SVN       
 Keywords:  add_view, change_view, ModelForm  |       Stage:  Unreviewed
Has_patch:  0                                 |  
----------------------------------------------+-----------------------------
 add_view, change_view has the following code:

 ModelForm = self.get_form(request)
 ...

  form = ModelForm(request.POST, request.FILES)
 or
  form = ModelForm(initial=initial)
 or
  form = ModelForm(request.POST, request.FILES, instance=obj)

 I would propose:

 if isinstance(ModelForm, ModelFormMetaclass):
     form = ModelForm(request.POST, request.FILES)
 else
     form = ModelForm

 This way gives the flexibility to override the function get_form(self,
 request, obj=None, **kwargs), which could return a
 modelform_factory(self.model, **defaults) or an instance of a model form.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/10305>
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-updates@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