0
0
mirror of https://github.com/wagtail/wagtail.git synced 2024-12-01 11:41:20 +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" %} {% extends "wagtailadmin/generic/base.html" %}
{% load wagtailusers_tags wagtailimages_tags wagtailadmin_tags i18n %} {% load wagtailusers_tags i18n %}
{% block titletag %}{% trans "Add group" %}{% endblock %}
{% block extra_css %} {% block extra_css %}
{{ block.super }} {{ block.super }}
@ -9,34 +7,28 @@
{{ form_media.css }} {{ form_media.css }}
{% endblock %} {% endblock %}
{% block content %} {% block main_content %}
<form action="{% url 'wagtailusers_groups:add' %}" method="POST" novalidate>
{% csrf_token %}
{% trans "Add group" as add_group_str %} <ul class="fields">
{% include "wagtailadmin/shared/header.html" with title=add_group_str icon="group" only %} {% block fields %}
<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 %}
<li> <li>
{% format_permissions permission_bound_field=form.permissions %} {% include "wagtailadmin/shared/field.html" with field=form.name %}
</li> </li>
{% for panel in permission_panels %} {% block extra_fields %}{% endblock extra_fields %}
<li> {% endblock fields %}
{{ panel.as_admin_panel }} <li>
</li> {% format_permissions permission_bound_field=form.permissions %}
{% endfor %} </li>
<li><input type="submit" value='{% trans "Add group" %}' class="button" /></li> {% for panel in permission_panels %}
</ul> <li>
</form> {{ panel.as_admin_panel }}
</div> </li>
{% endfor %}
<li><input type="submit" value="{% trans 'Add group' %}" class="button" /></li>
</ul>
</form>
{% endblock %} {% endblock %}
{% block extra_js %} {% block extra_js %}

View File

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