0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-11-30 01:46:24 +01:00

Extend generic base template for groups create template

This allows us to reuse the header parts, including breadcrumbs.
This commit is contained in:
Sage Abdullah 2023-09-12 10:30:22 +01:00
parent 7e7fc56d6c
commit 0709c31933
No known key found for this signature in database
GPG Key ID: EB1A33CC51CC0217
2 changed files with 24 additions and 29 deletions

View File

@ -1,7 +1,5 @@
{% extends "wagtailadmin/base.html" %}
{% load wagtailusers_tags wagtailimages_tags wagtailadmin_tags i18n %}
{% block titletag %}{% trans "Add group" %}{% endblock %}
{% extends "wagtailadmin/generic/base.html" %}
{% load wagtailusers_tags i18n %}
{% block extra_css %}
{{ block.super }}
@ -9,34 +7,28 @@
{{ form_media.css }}
{% endblock %}
{% block content %}
{% block main_content %}
<form action="{% url 'wagtailusers_groups:add' %}" method="POST" novalidate>
{% csrf_token %}
{% trans "Add group" as add_group_str %}
{% include "wagtailadmin/shared/header.html" with title=add_group_str icon="group" only %}
<div class="nice-padding">
<form action="{% url 'wagtailusers_groups:add' %}" method="POST" novalidate>
{% csrf_token %}
<ul class="fields">
{% block fields %}
<li>
{% include "wagtailadmin/shared/field.html" with field=form.name %}
</li>
{% block extra_fields %}{% endblock extra_fields %}
{% endblock fields %}
<ul class="fields">
{% block fields %}
<li>
{% format_permissions permission_bound_field=form.permissions %}
{% include "wagtailadmin/shared/field.html" with field=form.name %}
</li>
{% for panel in permission_panels %}
<li>
{{ panel.as_admin_panel }}
</li>
{% endfor %}
<li><input type="submit" value='{% trans "Add group" %}' class="button" /></li>
</ul>
</form>
</div>
{% block extra_fields %}{% endblock extra_fields %}
{% endblock fields %}
<li>
{% format_permissions permission_bound_field=form.permissions %}
</li>
{% for panel in permission_panels %}
<li>
{{ panel.as_admin_panel }}
</li>
{% endfor %}
<li><input type="submit" value="{% trans 'Add group' %}" class="button" /></li>
</ul>
</form>
{% endblock %}
{% block extra_js %}

View File

@ -76,6 +76,9 @@ class CreateView(PermissionPanelFormsMixin, generic.CreateView):
page_title = _("Add group")
success_message = _("Group '%(object)s' created.")
def get_page_subtitle(self):
return ""
def post(self, request, *args, **kwargs):
"""
Handle POST requests: instantiate a form instance with the passed