Probably a simple question but having trouble implementing a form preview page using django-formtools. I've configured everything per the docs. I'm stuck on what to add to the done() method to save the data to db.
forms.py
class JobForm(ModelForm): class Meta: model = Job fields = ('title', 'category', 'company', 'website', 'description',) class JobFormPreview(FormPreview): def done(self, request, cleaned_data): # add what here to save form data as object? return HttpResponseRedirect('/success')urls.py
... url(r'^jobs/new/$', JobFormPreview(JobForm), name='job_form'), ...Using the default templates. The form and preview both render fine, but obviously data doesn't save on submit. Tried self.form.save() but get an error save() missing 1 required positional argument: 'self'.
I appreciate any guidance.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/a2a45d4e-d7cf-469b-9721-990488a3450f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment