mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-14 10:13:13 +00:00
Provide a default form rendering in generic add/edit views that loops over hidden_fields and visible_fields
This means that the wagtailsites templates doesn't have to override the 'form' block.
This commit is contained in:
parent
9efa3af564
commit
e9e0b135c8
5 changed files with 16 additions and 13 deletions
|
|
@ -9,9 +9,17 @@
|
|||
|
||||
<form action="{{ view.get_add_url }}" method="POST">
|
||||
{% csrf_token %}
|
||||
|
||||
{% block hidden_fields %}
|
||||
{% for field in form.hidden_fields %}{{ field }}{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
<div class="nice-padding">
|
||||
<ul class="fields">
|
||||
{% block form %}
|
||||
{% for field in form.visible_fields %}
|
||||
{% include "wagtailadmin/shared/field_as_li.html" %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
<li><input type="submit" value="{% trans 'Save' %}" /></li>
|
||||
</ul>
|
||||
|
|
|
|||
|
|
@ -10,9 +10,16 @@
|
|||
<div class="nice-padding">
|
||||
<form action="{{ view.get_edit_url }}" method="POST">
|
||||
{% csrf_token %}
|
||||
|
||||
|
||||
{% block hidden_fields %}
|
||||
{% for field in form.hidden_fields %}{{ field }}{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
<ul class="fields">
|
||||
{% block form %}
|
||||
{% for field in form.visible_fields %}
|
||||
{% include "wagtailadmin/shared/field_as_li.html" %}
|
||||
{% endfor %}
|
||||
{% endblock %}
|
||||
|
||||
<li>
|
||||
|
|
|
|||
|
|
@ -1,4 +0,0 @@
|
|||
{% include "wagtailadmin/shared/field_as_li.html" with field=form.hostname %}
|
||||
{% include "wagtailadmin/shared/field_as_li.html" with field=form.port %}
|
||||
{% include "wagtailadmin/shared/field_as_li.html" with field=form.root_page %}
|
||||
{% include "wagtailadmin/shared/field_as_li.html" with field=form.is_default_site %}
|
||||
|
|
@ -1,9 +1,5 @@
|
|||
{% extends "wagtailadmin/generic/create.html" %}
|
||||
|
||||
{% block form %}
|
||||
{% include "wagtailsites/_form.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_js %}
|
||||
{% include "wagtailadmin/pages/_editor_js.html" %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
|
|
@ -1,9 +1,5 @@
|
|||
{% extends "wagtailadmin/generic/edit.html" %}
|
||||
|
||||
{% block form %}
|
||||
{% include "wagtailsites/_form.html" %}
|
||||
{% endblock %}
|
||||
|
||||
{% block extra_js %}
|
||||
{% include "wagtailadmin/pages/_editor_js.html" %}
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Reference in a new issue