1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #21967: Added check for object in ModelFormMixin.get_form_kwargs.

Thanks lagovas.lagovas at gmail.com for the report.
This commit is contained in:
Ryan Kaskel
2014-02-09 10:53:23 +00:00
committed by Tim Graham
parent 80cd64ee17
commit 75a96f06e9
2 changed files with 9 additions and 2 deletions

View File

@@ -122,7 +122,8 @@ class ModelFormMixin(FormMixin, SingleObjectMixin):
Returns the keyword arguments for instantiating the form.
"""
kwargs = super(ModelFormMixin, self).get_form_kwargs()
kwargs.update({'instance': self.object})
if hasattr(self, 'object'):
kwargs.update({'instance': self.object})
return kwargs
def get_success_url(self):