*Hi,*
*What i understood is that you need two different forms on single page. and
later on you want to map feedback form as site specific.*
*So you can do with two different ways:*
*1) define two different form action path.*
* ...form fields... ...form
fields...*
*2) you have will
I managed to do it! Thanks to your help.
Ok all you need to do is this:
views.py:
class ReportFormView(FormView):
form_class = ReportForm
template_name = 'contact_form/contact_form.html'
def form_valid(self, form):
form.save()
return super(ReportFormView,
OK, I read a little of the library documentation, and this is what you have
to do I think
1. subclass the ContactForm (you already have that)
2. subclass the ContactFormView from the library, at least with this:
class ReportFormView(ContactFormView):
form_class = ReportForm
3. Map this view
Thanks for the reply. I was wondering about the if statement about
request.type as well, but I took the code from Stackoverflow and a
combination of the original source code. It calls a Class.as_view() and I
wasn't sure if I need to overwrite that as well. I didn't really want to
write all the
According to the official documentation I'm still unsure if I need to type
anything in my views.py at all.
As far as I understand this, I just need to subclass ContactForm somehow:
class ContactForm(forms.Form): """ The base contact form class from which all
contact form classes should
Thanks for the reply. I was wondering about the if statement about
request.type as well, but I took the code from Stackoverflow and a
combination of the original source code. It calls a Class.as_view() and I
wasn't sure if I need to overwrite that as well. I didn't really want to
write all the
Right now the "reportForm" variable is pointing to the RequestForm class,
not to an object, so you need to do it like this
reportForm = ReportForm()# Take note of the parenthesis
In your template, your form tag need an action attribute (well, it's not
mandatory but it is highly advised). In
I need to include two different contact forms in my app. One a general
contact form and another Report / Feedback form that pre-fills some data
depending on which site it was called from.
So I hit google, found django-contact-form, installed it and after creating
some basic templates (and rest
8 matches
Mail list logo