universal disabled form template
authorJan Szejko <jan.szejko@gmail.com>
Mon, 9 May 2016 08:58:25 +0000 (10:58 +0200)
committerJan Szejko <jan.szejko@gmail.com>
Mon, 9 May 2016 08:58:25 +0000 (10:58 +0200)
contact/templates/contact/disabled_contact_form.html [new file with mode: 0644]
contact/views.py
edumed/contact_forms.py

diff --git a/contact/templates/contact/disabled_contact_form.html b/contact/templates/contact/disabled_contact_form.html
new file mode 100644 (file)
index 0000000..a3ccfc8
--- /dev/null
@@ -0,0 +1,13 @@
+{% extends "base.html" %}
+
+{% block title %}{{ title }}{% endblock %}
+
+{% block body %}
+
+    <h1>{{ title }}</h1>
+
+    {% block contact_form_description %}
+        <p class="notice">Rejestracja została zamknięta.</p>
+    {% endblock %}
+
+{% endblock %}
index 4d5a40f..e52b6b2 100644 (file)
@@ -18,7 +18,7 @@ def form(request, form_tag, force_enabled=False):
             not (force_enabled and request.user.is_superuser)):
         template = getattr(form_class, 'disabled_template', None)
         if template:
-            return render(request, template)
+            return render(request, template, {'title': form_class.form_title})
         raise Http404
     if request.method == 'POST':
         form = form_class(request.POST, request.FILES)
index 42de0a6..1884d0d 100644 (file)
@@ -376,7 +376,7 @@ class SuperwizjaForm(ContactForm):
 
 class CybernauciForm(ContactForm):
     disabled = True
-    disabled_template = 'wtem/disabled_contact_form.html'
+    disabled_template = 'contact/disabled_contact_form.html'
     form_tag = 'trenerzy-cybernauci'
     form_title = u"Cybernauci – szkolenie dla trenerów"
     admin_list = ['nazwisko', 'instytucja', 'contact']