From 29c752e57221e0ff1c83a776580672f7c65657b2 Mon Sep 17 00:00:00 2001 From: Santiago Lamora Date: Thu, 24 Jun 2021 13:19:54 +0200 Subject: [PATCH] Lay out mail form using bootstrap4 --- musician/templates/musician/mail_form.html | 11 ++++++++--- musician/views.py | 2 ++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/musician/templates/musician/mail_form.html b/musician/templates/musician/mail_form.html index 8451647..c6bb3ec 100644 --- a/musician/templates/musician/mail_form.html +++ b/musician/templates/musician/mail_form.html @@ -1,10 +1,15 @@ {% extends "musician/base.html" %} -{% load i18n %} +{% load bootstrap4 i18n %} {% block content %} +

{{ service.verbose_name }}

+
{% csrf_token %} - {{ form }} - + {% bootstrap_form form %} + {% buttons %} + {% trans "Cancel" %} + + {% endbuttons %}
{% endblock %} diff --git a/musician/views.py b/musician/views.py index 387c4e6..196b688 100644 --- a/musician/views.py +++ b/musician/views.py @@ -207,6 +207,7 @@ class MailCreateView(CustomContextMixin, UserTokenRequiredMixin, FormView): template_name = "musician/mail_form.html" form_class = MailForm success_url = reverse_lazy("musician:mails") + extra_context = {'service': service_class} def get_form_kwargs(self): kwargs = super().get_form_kwargs() @@ -231,6 +232,7 @@ class MailUpdateView(CustomContextMixin, UserTokenRequiredMixin, FormView): template_name = "musician/mail_form.html" form_class = MailForm success_url = reverse_lazy("musician:mails") + extra_context = {'service': service_class} def get_form_kwargs(self): kwargs = super().get_form_kwargs()