I'm using FormPreview with a ModelForm. My done() method gets the request
and the cleaned_data once form.is_valid() evaluates to True. I'm wondering
if I need to do anything special to use the cleaned_data or handle the
form-uploaded files. My current class definition is:
class WSMRTaskFormPreview(FormPreview):
def done(self, request, cleaned_data):
WSMRTaskForm(request.POST, request.FILES).save()
return HttpResponseRedirect(reverse('success'))
but I'm wondering if it should be:
class WSMRTaskFormPreview(FormPreview):
def done(self, request, cleaned_data):
WSMRTaskForm(cleaned_data, request.FILES).save() # cleaned_data
instead of request.POST
return HttpResponseRedirect(reverse('success'))
or even:
class WSMRTaskFormPreview(FormPreview):
def done(self, request, cleaned_data):
if request.FILES.has_key('mtz_fp'):
WSMRTaskForm(request.POST, request.FILES).save()
return HttpResponseRedirect(reverse('success'))
else:
return HttpResponseRedirect(reverse('missing_files'))
TIA, Ian
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.