Commit 4f0ef1aa by benjaoming

pull #139 - form data from args or kwargs

parent 159025bc
...@@ -120,11 +120,13 @@ class EditForm(forms.Form, SpamProtectionMixin): ...@@ -120,11 +120,13 @@ class EditForm(forms.Form, SpamProtectionMixin):
data = None data = None
if len(args) > 0: if len(args) > 0:
data = args[0] data = args[0]
if not data: args = args[1:]
if data is None:
data = kwargs.get('data', None) data = kwargs.get('data', None)
if data: if data:
self.presumed_revision = data.get('current_revision', None) self.presumed_revision = data.get('current_revision', None)
if not str(self.presumed_revision) == str(self.initial_revision.id): if not str(self.presumed_revision) == str(self.initial_revision.id):
print "IT"
newdata = {} newdata = {}
for k,v in data.items(): for k,v in data.items():
newdata[k] = v newdata[k] = v
...@@ -133,6 +135,9 @@ class EditForm(forms.Form, SpamProtectionMixin): ...@@ -133,6 +135,9 @@ class EditForm(forms.Form, SpamProtectionMixin):
data.get('content', "")) data.get('content', ""))
newdata['title'] = current_revision.title newdata['title'] = current_revision.title
kwargs['data'] = newdata kwargs['data'] = newdata
else:
# Always pass as kwarg
kwargs['data'] = data
kwargs['initial'] = initial kwargs['initial'] = initial
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment