diff --git a/apps/map/forms.py b/apps/map/forms.py index 977c3aa..9af63f7 100644 --- a/apps/map/forms.py +++ b/apps/map/forms.py @@ -1,4 +1,5 @@ from django import forms +from django.urls import reverse from crispy_forms.helper import FormHelper from crispy_forms.layout import Submit from leaflet.forms.widgets import LeafletWidget @@ -7,7 +8,7 @@ from .models import CaseStudy class BaseCaseStudyForm(forms.ModelForm): - + """Base form class for the CaseStudy model.""" def __init__(self, *args, **kwargs): super(BaseCaseStudyForm, self).__init__(*args, **kwargs) self.helper = FormHelper() @@ -26,6 +27,12 @@ class BaseCaseStudyForm(forms.ModelForm): class ShortCaseStudyForm(BaseCaseStudyForm): + """Short version of the CaseStudy form.""" + + def __init__(self, *args, **kwargs): + super(ShortCaseStudyForm, self).__init__(*args, **kwargs) + self.helper.form_action = reverse('short-form') + class Meta(BaseCaseStudyForm.Meta): fields = [ 'entry_name', @@ -50,5 +57,10 @@ class ShortCaseStudyForm(BaseCaseStudyForm): class LongCaseStudyForm(BaseCaseStudyForm): + """Long version of the CaseStudy form.""" + def __init__(self, *args, **kwargs): + super(LongCaseStudyForm, self).__init__(*args, **kwargs) + self.helper.form_action = reverse('long-form') + class Meta(BaseCaseStudyForm.Meta): fields = '__all__' diff --git a/apps/map/templates/map/form-success.html b/apps/map/templates/map/form-success.html new file mode 100644 index 0000000..13b0143 --- /dev/null +++ b/apps/map/templates/map/form-success.html @@ -0,0 +1,35 @@ +{% extends "base_page.html" %} +{% load bootstrap3 %} +{% load compress %} +{% load i18n %} +{% load humanize %} + +{% block stylesheets %} +{{ block.super }} + +{% endblock %} + +{% block title %}{% trans "Thanks!" %}{% endblock %} +{% block inner %} +
{% trans "Your submission will be reviewed shortly. We will update you via email." %}
+{% endblock %} \ No newline at end of file diff --git a/apps/map/templates/map/index.html b/apps/map/templates/map/index.html index 8a29c75..34d8339 100644 --- a/apps/map/templates/map/index.html +++ b/apps/map/templates/map/index.html @@ -104,7 +104,7 @@ map.on('click', function(e) { var popup = L.popup() .setLatLng(e.latlng) - .setContent("{% trans "Submit a Case Study" %}") + .setContent("{% trans "Submit a Case Study" %}") .openOn(map); }); } diff --git a/apps/map/urls.py b/apps/map/urls.py index 688bca4..6761d76 100644 --- a/apps/map/urls.py +++ b/apps/map/urls.py @@ -10,5 +10,6 @@ urlpatterns = [ url(r'^case-study/create/?$', views.Create.as_view(), name="create"), url(r'^case-study/create/short/?$', views.ShortForm.as_view(), name='short-form'), url(r'^case-study/create/long/?$', views.LongForm.as_view(), name='long-form'), + url(r'^case-study/create/success/?$', views.FormSuccess.as_view(), name='form-success'), url(r'^case-study/(?P