Opened 16 years ago
Last modified 5 years ago
#10305 new
contrib/admin/options.py add_view, change_view — at Initial Version
Description ¶
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.
According to the ticket's flags, the next step(s) to move this issue forward are:
- To provide a patch by sending a pull request. Claim the ticket when you start working so that someone else doesn't duplicate effort. Before sending a pull request, review your work against the patch review checklist. Check the "Has patch" flag on the ticket after sending a pull request and include a link to the pull request in the ticket comment when making that update. The usual format is:
[https://github.com/django/django/pull/#### PR]
.