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 of the configuration) I was able to make use 
of /contact/ to present a basic form which takes in Name, Email and 
Message. Works fine.

Now I need that Report Form. The idea is to have a 'Report' Button on the 
Website which maps to /report/$Parameter (or maybe it will just put the 
parameter into request, not sure yet how to do this).
However I have troubles getting my Custom Form to work. I tried to create a 
new view that uses my custom form which just inherits from ContactForm:

forms.py:
class ReportForm(ContactForm):
    additional = forms.CharField(max_length=100, label='additional field 
test')
    subject_template_name = "contact_form/report_form_subject.txt"
    template_name = 'contact_form/report_form.txt'



views.py:
def report(request):
    reportForm = ReportForm
    return render(request, 'play/report.html', {'form': reportForm})




template report.html:
{% extends 'base.html' %}

{% block body_block %}
<h2>Report Form</h2>
  <p>To send us a message fill out the below form.</p>
  <form method="post">{% csrf_token %}
    <p>Name: <input type="text" name="name"></p>
    <p>Your e-mail: <input type="text" name="email"></p>
     <p>additional field test: <input type="text" name="additional"</p>
    <p>Message: <textarea name="body" rows="10" cols="50"></textarea></p>
    <input type="submit" value="Submit">
  </form>
{% endblock %}

However it's not working at all. I can see the form displayed thanks to the 
HTML Template, but nothing is happening when I press Submit. There is no 
example on the website on how to subclass it :(
http://django-contact-form.readthedocs.org/en/latest/quickstart.html
Or should I just copy and paste the whole code from here and adapt it to 
include additional fields: 
https://bitbucket.org/ubernostrum/django-contact-form/src/4b7d2fa20c1d01568fb7c4c800155378e176923b/contact_form/forms.py?at=default



-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/e72e813c-d78b-433f-8444-e76a4129c862%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to