Skip to content

Commit

Permalink
Merge pull request #151 from rma4ok/fix-form-params
Browse files Browse the repository at this point in the history
[fix] referencing obj variable
  • Loading branch information
losintikfos committed Jan 9, 2016
2 parents 92d7c74 + 7a5d345 commit 68ccb1e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions flask_mongoengine/wtf/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
class ModelForm(Form):
"""A WTForms mongoengine model form"""

def __init__(self, formdata=None, obj=None, prefix='', **kwargs):
self.instance = (kwargs.pop('instance', None) or kwargs.get('obj', None))
def __init__(self, formdata=None, obj=None, **kwargs):
self.instance = (kwargs.pop('instance', None) or obj)
if self.instance and not formdata:
obj = self.instance
self.formdata = formdata
super(ModelForm, self).__init__(formdata, obj, prefix, **kwargs)
super(ModelForm, self).__init__(formdata, obj, **kwargs)

def save(self, commit=True, **kwargs):
if self.instance:
Expand Down

0 comments on commit 68ccb1e

Please sign in to comment.