Lay out mail form using bootstrap4

This commit is contained in:
Santiago L 2021-06-24 13:19:54 +02:00
parent 4d5497f2fa
commit 29c752e572
2 changed files with 10 additions and 3 deletions

View File

@ -1,10 +1,15 @@
{% extends "musician/base.html" %}
{% load i18n %}
{% load bootstrap4 i18n %}
{% block content %}
<h1 class="service-name">{{ service.verbose_name }}</h1>
<form method="post">
{% csrf_token %}
{{ form }}
<button type="submit">OK</button>
{% bootstrap_form form %}
{% buttons %}
<a class="btn btn-light mr-2" href="{% url 'musician:mails' %}">{% trans "Cancel" %}</a>
<button type="submit" class="btn btn-secondary">{% trans "Save" %}</button>
{% endbuttons %}
</form>
{% endblock %}

View File

@ -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()