diff --git a/citavi_mapper/settings.py b/citavi_mapper/settings.py index 3343d42..a7e5938 100644 --- a/citavi_mapper/settings.py +++ b/citavi_mapper/settings.py @@ -21,7 +21,7 @@ BASE_DIR = os.path.dirname(os.path.dirname(__file__)) # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True -# PIPELINE_ENABLED = False +PIPELINE_ENABLED = False TEMPLATE_DEBUG = True @@ -119,6 +119,12 @@ PIPELINE_JS = { ), 'output_filename': 'js/b.js', }, + 'formsets': { + 'source_filenames': ( + 'js/jquery.formset.js', + ), + 'output_filename': 'js/f.js', + } } CRISPY_TEMPLATE_PACK = 'bootstrap3' diff --git a/frontend/forms.py b/frontend/forms.py index cebe7f4..eb07f39 100644 --- a/frontend/forms.py +++ b/frontend/forms.py @@ -81,3 +81,54 @@ class PersonMapForm(forms.Form): global_identity = forms.ModelChoiceField(queryset=PersonGlobalIdentity.objects.all(), required=False) preferred_identity = forms.BooleanField(initial=False, required=False) + +class PresentationForm(forms.Form): + def __init__(self, *args, **kwargs): + super(PresentationForm, self).__init__(*args, **kwargs) + self.helper = FormHelper() + self.helper.form_class = u'form-horizontal' + self.helper.label_class = u'col-lg-2' + self.helper.field_class = u'col-lg-4' + self.helper.form_method = u'post' + self.helper.layout = Layout( + u'title', + u'event_type', + u'abstract', + u'given_name', + u'additional_name', + u'family_name', + u'hsh_membership', + u'date', + u'rahmen', + u'workshop', + u'place', + u'startdate', + u'enddate', + u'comments', + u'email', + Submit(u'send', u'Abschicken', css_class=u'btn-default') + ) + pass + + title = forms.CharField() + event_type = forms.ChoiceField(choices=[(u'new', u'Hauptvortrag'), (u'existing', u'andere Veranstaltung')], initial=u'new', widget=forms.RadioSelect()) + abstract = forms.CharField() + + # Teilnehmer + given_name = forms.CharField() + additional_name = forms.CharField() + family_name = forms.CharField() + hsh_membership = forms.ChoiceField(choices=[(u'new', u'Yes'), (u'existing', u'No'), (u'idk', u'Maybe')], initial=u'new', widget=forms.RadioSelect()) + + + # Event (other event) + date = forms.DateField() + rahmen = forms.CharField() + workshop = forms.BooleanField() + place = forms.CharField() + startdate = forms.DateField() + enddate = forms.DateField() + + comments = forms.CharField() + email = forms.EmailField() + diff --git a/frontend/templates/hello.html b/frontend/templates/hello.html index 14c2d66..1cce49e 100644 --- a/frontend/templates/hello.html +++ b/frontend/templates/hello.html @@ -1,5 +1,10 @@ {% extends "layout/base.html" %} +{% block head%} + {% load crispy_forms_tags %} +{% endblock %} {% block content %} hallo
zurück +

{% crispy form %}

+ {% endblock %} \ No newline at end of file diff --git a/frontend/templates/layout/base.html b/frontend/templates/layout/base.html index f93cebc..533a7cf 100644 --- a/frontend/templates/layout/base.html +++ b/frontend/templates/layout/base.html @@ -12,6 +12,8 @@ {% compressed_css 'bootstrap' %} {% compressed_js 'bootstrap' %} + + {% compressed_js 'formsets' %} {% compressed_css 'frontend' %} diff --git a/frontend/views.py b/frontend/views.py index fe130f1..e48477d 100644 --- a/frontend/views.py +++ b/frontend/views.py @@ -14,7 +14,7 @@ from django.contrib.auth.views import login, logout from django.core.urlresolvers import reverse -from frontend.forms import NewProjectForm, FileUploadForm, PersonMapForm +from frontend.forms import NewProjectForm, FileUploadForm, PersonMapForm, PresentationForm from frontend.models import Project @@ -101,10 +101,15 @@ class ProtectedUpdateView(LoggedInMixin, MyUpdateView): class IndexView(ProtectedTemplateView): template_name = u'index.html' page_title = u'Index' - -class HelloView(ProtectedTemplateView): + +class HelloView(ProtectedFormView): template_name = u'hello.html' page_title = u'Hello' + form_class = PresentationForm + success_url = u'/hello' + + def form_valid(self, form): + pass class ProjectView(ProtectedFormView): template_name = u'projects.html'