mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-09-16 01:02:29 +03:00
Revert "Resource's get_bound_form() populates instance's form on GET"
This reverts commit d0f758ee2f
.
This commit is contained in:
parent
7679f3791c
commit
84a4461ac9
|
@ -309,11 +309,14 @@ class ModelResource(FormResource):
|
|||
return None
|
||||
|
||||
# Instantiate the ModelForm as appropriate
|
||||
form_kwargs = {'data': data, 'files': files}
|
||||
# Bound to an existing model instance
|
||||
if hasattr(self.view, 'model_instance'): form_kwargs['instance'] = self.view.model_instance
|
||||
if data is not None or files is not None:
|
||||
if issubclass(form, forms.ModelForm) and hasattr(self.view, 'model_instance'):
|
||||
# Bound to an existing model instance
|
||||
return form(data, files, instance=self.view.model_instance)
|
||||
else:
|
||||
return form(data, files)
|
||||
|
||||
return form(**form_kwargs)
|
||||
return form()
|
||||
|
||||
def url(self, instance):
|
||||
"""
|
||||
|
|
Loading…
Reference in New Issue
Block a user