Website: Added order form. Some minor changes.

This commit is contained in:
Emanuel Schuetze 2012-07-23 22:17:24 +02:00
parent a22425dfef
commit 769bceb80e
9 changed files with 161 additions and 39 deletions

View File

@ -1,17 +1,29 @@
from django import forms from django import forms
from django.utils.translation import ugettext as _
TOPIC_CHOICES = (
('question', 'General question'),
('bug', 'Bug report'),
('reference', 'Add OpenSlides reference'),
)
class ContactForm(forms.Form): class ContactForm(forms.Form):
error_css_class = 'error' error_css_class = 'error'
required_css_class = 'required' required_css_class = 'required'
topic = forms.ChoiceField(choices=TOPIC_CHOICES) subject = forms.CharField(label=_("Betreff"))
subject = forms.CharField(max_length=100) message = forms.CharField(widget=forms.Textarea(), label=_("Nachricht"))
message = forms.CharField() sender = forms.EmailField(label=_("Absender"))
sender = forms.EmailField() cc_myself = forms.BooleanField(required=False,label=_("Kopie an meine Adresse"))
cc_myself = forms.BooleanField(required=False)
class OrderEventForm(forms.Form):
error_css_class = 'error'
required_css_class = 'required'
event_name = forms.CharField(label=_("Veranstaltungsname"))
event_description = forms.CharField(max_length=100, label=_("Kurzbeschreibung der Veranstaltung"))
event_date = forms.CharField(label=_("Veranstaltungszeitraum"))
event_location = forms.CharField(label=_("Veranstaltungsort"))
class OrderContactForm(forms.Form):
error_css_class = 'error'
required_css_class = 'required'
contact_organisation = forms.CharField(label=_("Organisation"))
contact_street = forms.CharField(label=_("Strasse"))
contact_postcode = forms.CharField(label=_("PLZ"))
contact_location = forms.CharField(label=_("Ort"))
contact_name = forms.CharField(label=_("Ansprechpartner"))
contact_phone = forms.CharField(label=_("Telefon"))
contact_email = forms.EmailField(label=_("E-Mail"))

View File

@ -23,6 +23,8 @@ DATABASES = {
SITE_ROOT = os.path.realpath(os.path.dirname(__file__)) SITE_ROOT = os.path.realpath(os.path.dirname(__file__))
EMAIL_HOST = "localhost"
# Local time zone for this installation. Choices can be found here: # Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
# although not all choices may be available on all operating systems. # although not all choices may be available on all operating systems.

View File

@ -177,3 +177,7 @@ form .error input, form .error textarea {
float: left; float: left;
margin-right: 20px; margin-right: 20px;
} }
input, textarea {
width: 380px;
}

View File

@ -13,25 +13,29 @@
{% block container %} {% block container %}
<div class="hero-unit"> <div class="hero-unit">
<div class="thumbnail span5" style="float:right; margin: 5px;"> <div class="row">
<img src="/static/img/agenda-overview_de.png" alt=""> <div class="span5">
</div>
<span>
<h1>OpenSlides</h1> <h1>OpenSlides</h1>
<br> <br>
<p>Mehr Transparenz.<br> Mehr Offenheit.<br> Mehr Effizienz.<br> <p>Mehr Transparenz.<br> Mehr Flexibilität.<br> Mehr Effizienz.<br>
<strong>Die Lösung für Ihre Versammlung!</strong></p> <strong>Die Lösung für Ihre Versammlung!</strong></p>
<br> <br>
<br> <br>
<a class="btn btn-primary btn-large" href="{% url download %}"> <a class="jumbotron btn btn-primary btn-large" href="{% url download %}">
Download &raquo; Download
</a> </a>
<a class="btn btn-large" href="{% url demo %}"> <a class="jumbotron btn btn-large" href="{% url demo %}">
Demo Demo
</a> </a>
</p> </p>
</span> </div>
<div class="span5">
<div class="thumbnail">
<img src="/static/img/agenda-overview_de.png" alt="">
</div>
</div>
</div>
</div> </div>
<div class="row"> <div class="row">

View File

@ -0,0 +1,58 @@
{% extends "base.html" %}
{% load i18n %}
{% block title %}{{ block.super }} - {% trans "Bestellformular" %}{% endblock %}
{% block headline %}{% trans "Bestellformular" %}{% endblock %}
{% block mainmenu_pricing %}active{% endblock %}
{% block lead %}
Supportpaket OpenSlides
<strong>
{% if package == '1' %}Starter{% endif %}
{% if package == '2' %}Business{% endif %}
{% if package == '3' %}Premium{% endif %}
</strong>
{% endblock %}
{% block content %}
<div class="row">
<div class="span7">
<form action="" method="post">{% csrf_token %}
<fieldset>
<legend>{% trans "Ihre Veranstaltung" %}</legend>
{{ form_event.as_p }}
</fieldset>
<fieldset>
<legend>{% trans "Ihre Kontaktdaten" %}</legend>
{{ form_contact.as_p }}
</fieldset>
<input type="submit" value="Submit" />
</form>
</div>
<div class="span4 well">
<h3>OpenSlides {% if package == '1' %}Starter{% endif %}
{% if package == '2' %}Business{% endif %}
{% if package == '3' %}Premium{% endif %}
</h3>
<p class="price">
{% if package == '1' %}TODO,-{% endif %}
{% if package == '2' %}TODO,-{% endif %}
{% if package == '3' %}TODO,-{% endif %} &euro;
<small>zzgl. 19% MwSt.</small></p>
<br>
<p>Haben Sie noch Fragen?</p>
<p>Emanuel Schütze<br>
Intevation GmbH<br>
Neuer Graben 17<br>
D-49074 Osnabrück<br>
E-Mail: <a href="mailto:emanuel.schuetze@intevation.de">emanuel.schuetze@intevation.de</a><br>
Tel: ++49-541-335083-746</p>
</div>
</div>
{% endblock %}

View File

@ -2,7 +2,7 @@
{% load i18n %} {% load i18n %}
{% block title %}{{ block.super }} - Support{% endblock %} {% block title %}{{ block.super }} - {% trans "Preise" %}{% endblock %}
{% block headline %}Preise{% endblock %} {% block headline %}Preise{% endblock %}
{% block mainmenu_pricing %}active{% endblock %} {% block mainmenu_pricing %}active{% endblock %}
@ -31,11 +31,11 @@ Die Intevation GmbH bietet Ihnen professionelle
</td> </td>
<td><p class="price">TODO,- &euro; <td><p class="price">TODO,- &euro;
<small>zzgl. 19% MwSt.</small></p> <small>zzgl. 19% MwSt.</small></p>
<p><a class="btn btn-primary" href="#">Bestellen</a></p></td> <p><a class="btn btn-primary" href="{% url orderform '1' %}">Bestellen</a></p></td>
<td><p class="price">TODO,- &euro;<small>zzgl. 19% MwSt.</small></p> <td><p class="price">TODO,- &euro;<small>zzgl. 19% MwSt.</small></p>
<p><a class="btn btn-primary" href="#">Bestellen</a></p></td> <p><a class="btn btn-primary" href="{% url orderform '2' %}">Bestellen</a></p></td>
<td><p class="price">TODO,- &euro;<small>zzgl. 19% MwSt.</small></p> <td><p class="price">TODO,- &euro;<small>zzgl. 19% MwSt.</small></p>
<p><a class="btn btn-primary" href="#">Bestellen</a></p></td> <p><a class="btn btn-primary" href="{% url orderform '3' %}">Bestellen</a></p></td>
</tr> </tr>
<tr> <tr>
<td class="leftcolumn">Lizenzkostenfreie Nutzung<small>OpenSlides <td class="leftcolumn">Lizenzkostenfreie Nutzung<small>OpenSlides

View File

@ -0,0 +1,18 @@
{% extends "base.html" %}
{% load i18n %}
{% block title %}{{ block.super }} - Bestellbestätigung{% endblock %}
{% block headline %}Danke für Ihre Bestellung!{% endblock %}
{% block mainmenu_pricing %}active{% endblock %}
{% block lead %}
Vielen Dank für die Bestellung Ihres OpenSlides-Supportpakets!
Sie werden in Kürze von uns Antwort erhalten.
{% endblock %}
{% block content %}
<p>Ein USB-Stick mit Ihrer individuell vorkonfigurierten OpenSlides-Installation wird erstellt.</p>
{% endblock %}

View File

@ -18,6 +18,8 @@ urlpatterns = i18n_patterns('',
url(r'^about/press$', TemplateView.as_view(template_name="press.html"), name='press',), url(r'^about/press$', TemplateView.as_view(template_name="press.html"), name='press',),
url(r'^download/$', TemplateView.as_view(template_name="download.html"), name='download',), url(r'^download/$', TemplateView.as_view(template_name="download.html"), name='download',),
url(r'^pricing/$', TemplateView.as_view(template_name="pricing.html"), name='pricing',), url(r'^pricing/$', TemplateView.as_view(template_name="pricing.html"), name='pricing',),
url(r'^pricing/order/(?P<package>\d{1})$', 'website.views.orderform', name='orderform',),
url(r'^pricing/thanks$', TemplateView.as_view(template_name="thanks-order.html"), name='thanksorder',),
url(r'^manual/$', TemplateView.as_view(template_name="manual.html"), name='manual',), url(r'^manual/$', TemplateView.as_view(template_name="manual.html"), name='manual',),
url(r'^faq/$', TemplateView.as_view(template_name="faq.html"), name='faq',), url(r'^faq/$', TemplateView.as_view(template_name="faq.html"), name='faq',),
url(r'^development/$', TemplateView.as_view(template_name="development.html"), name='development',), url(r'^development/$', TemplateView.as_view(template_name="development.html"), name='development',),

View File

@ -2,19 +2,12 @@
from django.shortcuts import render_to_response, render from django.shortcuts import render_to_response, render
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from website.forms import ContactForm from website.forms import ContactForm, OrderEventForm, OrderContactForm
#class TemplateView(TemplateView):
# def get_context_data(self, **kwargs):
# context = super(TemplateView, self).get_context_data(**kwargs)
# context[request] = self.request
# return context
def contactform(request): def contactform(request):
if request.method == 'POST': # If the form has been submitted... if request.method == 'POST':
form = ContactForm(request.POST) # A form bound to the POST data form = ContactForm(request.POST)
if form.is_valid(): # All validation rules pass if form.is_valid():
subject = form.cleaned_data['subject'] subject = form.cleaned_data['subject']
message = form.cleaned_data['message'] message = form.cleaned_data['message']
sender = form.cleaned_data['sender'] sender = form.cleaned_data['sender']
@ -22,13 +15,42 @@ def contactform(request):
recipients = ['emanuel@intevation.de'] recipients = ['emanuel@intevation.de']
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('/demo/') # Redirect after POST return HttpResponseRedirect('/contact/')
else: else:
form = ContactForm() # An unbound form form = ContactForm()
return render(request, 'contact-form.html', { return render(request, 'contact-form.html', {
'form': form, 'form': form,
}) })
def orderform(request, package='2'):
if request.method == 'POST':
form_event = OrderEventForm(request.POST)
form_contact = OrderContactForm(request.POST)
if form_event.is_valid() and form_contact.is_valid():
# event
event_name = form_event.cleaned_data['event_name']
event_description = form_event.cleaned_data['event_description']
event_date = form_event.cleaned_data['event_date']
event_location = form_event.cleaned_data['event_location']
# contact
contact_name = form_contact.cleaned_data['contact_name']
contact_phone = form_contact.cleaned_data['contact_phone']
contact_email = form_contact.cleaned_data['contact_email']
# mail
recipients = ['emanuel@intevation.de']
# recipients.append(contact_email)
message = "%s" % event_name
from django.core.mail import send_mail
send_mail("Bestellung", message, contact_email, recipients)
return HttpResponseRedirect('/pricing/thanks')
else:
form_event = OrderEventForm()
form_contact = OrderContactForm()
return render(request, 'order-form.html', {
'form_event': form_event,
'form_contact': form_contact,
'package': package,
})