From: Jan Szejko Date: Mon, 9 May 2016 08:58:25 +0000 (+0200) Subject: universal disabled form template X-Git-Url: https://git.mdrn.pl/edumed.git/commitdiff_plain/30343946f333b9b63113bdda185c30924bab0337 universal disabled form template --- diff --git a/contact/templates/contact/disabled_contact_form.html b/contact/templates/contact/disabled_contact_form.html new file mode 100644 index 0000000..a3ccfc8 --- /dev/null +++ b/contact/templates/contact/disabled_contact_form.html @@ -0,0 +1,13 @@ +{% extends "base.html" %} + +{% block title %}{{ title }}{% endblock %} + +{% block body %} + +

{{ title }}

+ + {% block contact_form_description %} +

Rejestracja została zamknięta.

+ {% endblock %} + +{% endblock %} diff --git a/contact/views.py b/contact/views.py index 4d5a40f..e52b6b2 100644 --- a/contact/views.py +++ b/contact/views.py @@ -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) diff --git a/edumed/contact_forms.py b/edumed/contact_forms.py index 42de0a6..1884d0d 100644 --- a/edumed/contact_forms.py +++ b/edumed/contact_forms.py @@ -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']