Website: Updated contact form function.

This commit is contained in:
Emanuel Schuetze 2012-07-25 19:54:58 +02:00
parent c481a2aac2
commit f0c50ea662
5 changed files with 24 additions and 19 deletions

View File

@ -8,7 +8,9 @@
{% block mainmenu_contact %}active{% endblock %} {% block mainmenu_contact %}active{% endblock %}
{% block lead %} {% block lead %}
Nehmen Sie Kontakt zu uns auf! Haben Sie Fragen oder Anregungen zu OpenSlides?
Sie können hier das Hauptentwicklerteam direkt kontaktieren.
Wir freuen uns auf Ihre Anfrage!
{% endblock %} {% endblock %}
{% block content %} {% block content %}
@ -16,7 +18,9 @@ Nehmen Sie Kontakt zu uns auf!
<form action="" method="post">{% csrf_token %} <form action="" method="post">{% csrf_token %}
{{ form.name_of_field.errors }} {{ form.name_of_field.errors }}
{{ form.as_p }} {{ form.as_p }}
<input type="submit" value="Submit" /> <button class="btn btn-large btn-primary" type="submit">
Senden</span>
</button><br>
</form> </form>
{% endblock %} {% endblock %}

View File

@ -36,8 +36,8 @@ uns Ihre Rückmeldung!
<a class="btn" href="http://mail.openslides.org/pipermail/users-en/">Archiv &raquo;</a></p> <a class="btn" href="http://mail.openslides.org/pipermail/users-en/">Archiv &raquo;</a></p>
<br> <br>
<p><strong>commit@openslides.org</strong><small>HG-commit-Mailingliste von hg.openslides.org (moderiert), für Entwickler</small></p> <p><strong>commit@openslides.org</strong><small>HG-commit-Mailingliste von hg.openslides.org (moderiert), für Entwickler</small></p>
<p><a class="btn btn-primary" href="http://mail.openslides.org/listinfo/commit/">Abonnieren &raquo;</a> <p><a class="btn btn-primary" href="http://mail.openslides.org/listinfo/commits/">Abonnieren &raquo;</a>
<a class="btn" href="http://mail.openslides.org/pipermail/commit/">Archiv &raquo;</a></p> <a class="btn" href="http://mail.openslides.org/pipermail/commits/">Archiv &raquo;</a></p>
</blockquote> </blockquote>
<p><small>Hinweis: Bitte abonnieren Sie eine Mailingliste bevor <p><small>Hinweis: Bitte abonnieren Sie eine Mailingliste bevor
Sie an diese schreiben!</small></p> Sie an diese schreiben!</small></p>

View File

@ -0,0 +1,12 @@
{% extends "base.html" %}
{% load i18n %}
{% block title %}{{ block.super }} - Absendebestätigung{% endblock %}
{% block headline %}Vielen Dank!{% endblock %}
{% block mainmenu_pricing %}active{% endblock %}
{% block lead %}
Vielen Dank für Ihre Nachricht!
{% endblock %}

View File

@ -5,11 +5,6 @@ from django.views.generic import TemplateView
from website import views from website import views
#from views import TemplateView
# Uncomment the next two lines to enable the admin:
# from django.contrib import admin
# admin.autodiscover()
urlpatterns = i18n_patterns('', urlpatterns = i18n_patterns('',
url(r'^i18n/', include('django.conf.urls.i18n')), url(r'^i18n/', include('django.conf.urls.i18n')),
url(r'^$', TemplateView.as_view(template_name="home.html"), name='home',), url(r'^$', TemplateView.as_view(template_name="home.html"), name='home',),
@ -27,6 +22,7 @@ urlpatterns = i18n_patterns('',
url(r'^development/$', TemplateView.as_view(template_name="development.html"), name='development',), url(r'^development/$', TemplateView.as_view(template_name="development.html"), name='development',),
url(r'^contact/$', TemplateView.as_view(template_name="contact.html"), name='contact',), url(r'^contact/$', TemplateView.as_view(template_name="contact.html"), name='contact',),
url(r'^contact/form$', 'website.views.contactform', name='contactform',), url(r'^contact/form$', 'website.views.contactform', name='contactform',),
url(r'^contact/thanks$', TemplateView.as_view(template_name="thanks-contact.html"), name='thankscontact',),
url(r'^donate/$', TemplateView.as_view(template_name="donate.html"), name='donate',), url(r'^donate/$', TemplateView.as_view(template_name="donate.html"), name='donate',),
url(r'^demo/$', TemplateView.as_view(template_name="demo.html"), name='demo',), url(r'^demo/$', TemplateView.as_view(template_name="demo.html"), name='demo',),
url(r'^impressum/$', TemplateView.as_view(template_name="impressum.html"), name='impressum',), url(r'^impressum/$', TemplateView.as_view(template_name="impressum.html"), name='impressum',),

View File

@ -1,7 +1,7 @@
#from django.views.generic import TemplateView
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.shortcuts import render_to_response, render from django.shortcuts import render_to_response, render
from website.forms import ContactForm, OrderEventForm, OrderContactForm from website.forms import ContactForm, OrderEventForm, OrderContactForm
def contactform(request): def contactform(request):
@ -12,12 +12,12 @@ def contactform(request):
message = form.cleaned_data['message'] message = form.cleaned_data['message']
sender = form.cleaned_data['sender'] sender = form.cleaned_data['sender']
cc_myself = form.cleaned_data['cc_myself'] cc_myself = form.cleaned_data['cc_myself']
recipients = ['emanuel@intevation.de'] recipients = ['support@openslides.org']
if cc_myself: if cc_myself:
recipients.append(sender) recipients.append(sender)
from django.core.mail import send_mail from django.core.mail import send_mail
send_mail(subject, message, sender, recipients) send_mail(subject, message, sender, recipients)
return HttpResponseRedirect(reverse('contact')) return HttpResponseRedirect(reverse('thankscontact'))
else: else:
form = ContactForm() form = ContactForm()
return render(request, 'contact-form.html', { return render(request, 'contact-form.html', {
@ -46,7 +46,6 @@ def orderform(request, package):
contact_email = form_contact.cleaned_data['contact_email'] contact_email = form_contact.cleaned_data['contact_email']
# mail # mail
recipients = ['emanuel@intevation.de'] recipients = ['emanuel@intevation.de']
# recipients.append(contact_email)
message = "Neue Bestellung: OpenSlides Paket #%s\n\n"\ message = "Neue Bestellung: OpenSlides Paket #%s\n\n"\
"Veranstaltungsname: %s\n"\ "Veranstaltungsname: %s\n"\
"Kurzbeschreibung der Veranstaltung: %s\n"\ "Kurzbeschreibung der Veranstaltung: %s\n"\
@ -66,12 +65,6 @@ def orderform(request, package):
contact_email) contact_email)
from django.core.mail import send_mail from django.core.mail import send_mail
send_mail("Bestellung OpenSlides-Supportpaket", message, contact_email, recipients) send_mail("Bestellung OpenSlides-Supportpaket", message, contact_email, recipients)
print message
#for key in request.POST:
# value = request.POST['key']
# loop through keys and values
#for key, value in request.POST.iteritems():
# print key, value
return HttpResponseRedirect(reverse('thanksorder')) return HttpResponseRedirect(reverse('thanksorder'))
else: else: