mirror of
https://github.com/django/django.git
synced 2025-10-28 08:06:09 +00:00
Fixed #11277 -- Hid labels of fields with HiddenInput widget in admin forms.
Thanks bartTC for the report.
This commit is contained in:
committed by
Tim Graham
parent
bcd4c3f27d
commit
dc3d2ac98c
@@ -84,6 +84,9 @@ class Fieldline(object):
|
||||
self.fields = [field]
|
||||
else:
|
||||
self.fields = field
|
||||
self.has_visible_field = not all(field in self.form.fields and
|
||||
self.form.fields[field].widget.is_hidden
|
||||
for field in self.fields)
|
||||
self.model_admin = model_admin
|
||||
if readonly_fields is None:
|
||||
readonly_fields = ()
|
||||
|
||||
@@ -18,6 +18,10 @@ form .form-row p {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
|
||||
/* FORM LABELS */
|
||||
|
||||
form h4 {
|
||||
|
||||
@@ -4,10 +4,10 @@
|
||||
<div class="description">{{ fieldset.description|safe }}</div>
|
||||
{% endif %}
|
||||
{% for line in fieldset %}
|
||||
<div class="form-row{% if line.fields|length_is:'1' and line.errors %} errors{% endif %}{% for field in line %}{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}">
|
||||
<div class="form-row{% if line.fields|length_is:'1' and line.errors %} errors{% endif %}{% if not line.has_visible_field %} hidden{% endif %}{% for field in line %}{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% endfor %}">
|
||||
{% if line.fields|length_is:'1' %}{{ line.errors }}{% endif %}
|
||||
{% for field in line %}
|
||||
<div{% if not line.fields|length_is:'1' %} class="field-box{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} errors{% endif %}"{% elif field.is_checkbox %} class="checkbox-row"{% endif %}>
|
||||
<div{% if not line.fields|length_is:'1' %} class="field-box{% if field.field.name %} field-{{ field.field.name }}{% endif %}{% if not field.is_readonly and field.errors %} errors{% endif %}{% if field.field.is_hidden %} hidden{% endif %}"{% elif field.is_checkbox %} class="checkbox-row"{% endif %}>
|
||||
{% if not line.fields|length_is:'1' and not field.is_readonly %}{{ field.errors }}{% endif %}
|
||||
{% if field.is_checkbox %}
|
||||
{{ field.field }}{{ field.label_tag }}
|
||||
|
||||
Reference in New Issue
Block a user