Ticket #1352: trunk-show_invisible_field_errors.diff

File trunk-show_invisible_field_errors.diff, 1.5 KB (added by Tom Tobin <korpios@…>, 19 years ago)

Show "invisible" admin form errors (against r2306 of trunk)

  • contrib/admin/templates/admin/change_form.html

     
    2727    <p class="errornote">
    2828    {% blocktrans count form.error_dict.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %}
    2929    </p>
     30{% if form.error_dict_invisible %}
     31    <ul class="errorlist">
     32{% for error_field in form.error_dict_invisible.items %}
     33{% for error_message in error_field.1 %}
     34    <li>Field '{{ error_field.0 }}' (not listed below): {{ error_message }}</li>
     35{% endfor %}
     36{% endfor %}
     37    </ul>
    3038{% endif %}
     39{% endif %}
    3140{% for bound_field_set in bound_manipulator.bound_field_sets %}
    3241   <fieldset class="module aligned {{ bound_field_set.classes }}">
    3342    {% if bound_field_set.name %}<h2>{{ bound_field_set.name }}</h2>{% endif %}
  • core/formfields.py

     
    101101    def __init__(self, manipulator, data, error_dict, edit_inline=True):
    102102        self.manipulator, self.data = manipulator, data
    103103        self.error_dict = error_dict
     104        self.error_dict_invisible = dict([(k, v) for (k, v) in self.error_dict.items() if k not in self.data])
    104105        self._inline_collections = None
    105106        self.edit_inline = edit_inline
    106107
Back to Top