mirror of
https://github.com/wagtail/wagtail.git
synced 2024-12-01 11:41:20 +01:00
Ensure that group add/edit forms import form media js/css
This commit is contained in:
parent
994e793773
commit
d14afdc2c3
@ -7,6 +7,7 @@
|
||||
{{ block.super }}
|
||||
|
||||
<link rel="stylesheet" href="{% static 'wagtailusers/css/groups_edit.css' %}" type="text/css" />
|
||||
{{ form_media.css }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
@ -7,6 +7,7 @@
|
||||
{{ block.super }}
|
||||
|
||||
<link rel="stylesheet" href="{% static 'wagtailusers/css/groups_edit.css' %}" type="text/css" />
|
||||
{{ form_media.css }}
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
@ -9,3 +9,5 @@
|
||||
<script src="{% static 'wagtailadmin/js/expanding_formset.js' %}"></script>
|
||||
<script src="{% static 'wagtailadmin/js/modal-workflow.js' %}"></script>
|
||||
<script src="{% static 'wagtailusers/js/group-form.js' %}"></script>
|
||||
|
||||
{{ form_media.js }}
|
||||
|
@ -89,6 +89,17 @@ class CreateView(PermissionPanelFormsMixin, generic.CreateView):
|
||||
else:
|
||||
return self.form_invalid(form)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
# add a 'form_media' variable for the collected js/css media from the form and all formsets
|
||||
form_media = context['form'].media
|
||||
for panel in context['permission_panels']:
|
||||
form_media += panel.media
|
||||
context['form_media'] = form_media
|
||||
|
||||
return context
|
||||
|
||||
|
||||
class EditView(PermissionPanelFormsMixin, generic.EditView):
|
||||
success_message = _("Group '{0}' updated.")
|
||||
@ -116,6 +127,17 @@ class EditView(PermissionPanelFormsMixin, generic.EditView):
|
||||
else:
|
||||
return self.form_invalid(form)
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
|
||||
# add a 'form_media' variable for the collected js/css media from the form and all formsets
|
||||
form_media = context['form'].media
|
||||
for panel in context['permission_panels']:
|
||||
form_media += panel.media
|
||||
context['form_media'] = form_media
|
||||
|
||||
return context
|
||||
|
||||
|
||||
class DeleteView(generic.DeleteView):
|
||||
success_message = _("Group '{0}' deleted.")
|
||||
|
Loading…
Reference in New Issue
Block a user