Show a nice message if the have no visible fields.

This commit is contained in:
Douglas Miranda 2013-09-27 00:52:18 -04:00
parent ee445acadf
commit b169d28653
3 changed files with 19 additions and 2 deletions

View file

@ -1,7 +1,12 @@
{% load admin2_tags crispy_forms_tags %}
{% load admin2_tags crispy_forms_tags i18n %}
{% for inline_form in formset %}
<div class="change_form space-below">
{{ inline_form|crispy }}
{% if not inline_form.visible_fields %}
<p class="alert alert-warning empty-form">
{% trans "This form doesn't have visible fields. This doesn't mean there isn't hidden fields." %}
</p>
{% endif %}
</div>
{% endfor %}

View file

@ -1,4 +1,4 @@
{% load admin2_tags %}
{% load admin2_tags i18n %}
<table class="table table-striped table-bordered">
<thead>
@ -21,6 +21,13 @@
{{ field }}
</td>
{% endfor %}
{% if not inline_form.visible_fields %}
<td>
<p class="alert alert-warning empty-form">
{% trans "This form doesn't have visible fields. This doesn't mean there isn't hidden fields." %}
</p>
</td>
{% endif %}
</tr>
{% endfor %}
<tr class="new_row">

View file

@ -54,6 +54,11 @@
<div class="change_form">
{% csrf_token %}
{{ form|crispy }}
{% if not form.visible_fields %}
<p class="alert alert-warning empty-form">
{% trans "This form doesn't have visible fields. This doesn't mean there isn't hidden fields." %}
</p>
{% endif %}
{% for formset in inlines %}
</div>