Ticket #16371: css_prefix.diff

File css_prefix.diff, 1.8 KB (added by silent1mezzo, 4 years ago)

Adds css_prefix

  • django/contrib/admin/options.py

     
    7171    formfield_overrides = {}
    7272    readonly_fields = ()
    7373    ordering = None
     74    css_prefix = None
    7475
    7576    def __init__(self):
    7677        overrides = FORMFIELD_FOR_DBFIELD_DEFAULTS.copy()
     
    734735            'content_type_id': ContentType.objects.get_for_model(self.model).id,
    735736            'save_as': self.save_as,
    736737            'save_on_top': self.save_on_top,
     738            'css_prefix': context['adminform'].model_admin.css_prefix or None,
    737739        })
    738740        if add and self.add_form_template is not None:
    739741            form_template = self.add_form_template
  • django/contrib/admin/templates/admin/includes/fieldset.html

     
    44        <div class="description">{{ fieldset.description|safe }}</div>
    55    {% endif %}
    66    {% for line in fieldset %}
    7         <div class="form-row{% if line.fields|length_is:'1' and line.errors %} errors{% endif %}{% for field in line %} {{ field.field.name }}{% endfor %}">
     7        <div class="form-row{% if line.fields|length_is:'1' and line.errors %} errors{% endif %}{% for field in line %} {{ css_prefix }}{{ field.field.name }}{% endfor %}">
    88            {% if line.fields|length_is:'1' %}{{ line.errors }}{% endif %}
    99            {% for field in line %}
    1010                <div{% if not line.fields|length_is:'1' %} class="field-box{% if not field.is_readonly and field.errors %} errors{% endif %}"{% endif %}>
Back to Top