Ticket #289: 289_error_list.2.diff
File 289_error_list.2.diff, 2.6 KB (added by , 18 years ago) |
---|
-
django/contrib/admin/templatetags/admin_modify.py
245 245 'class_names': " ".join(class_names), 246 246 } 247 247 admin_field_line = register.inclusion_tag('admin/field_line.html', takes_context=True)(admin_field_line) 248 249 def error_list(fields, error_dict): 250 errors = [] 251 for err_field_name, err_messages in error_dict.items(): 252 error = {} 253 for field in fields: 254 if field.name == err_field_name: 255 error['verbose_name'] = capfirst(field.verbose_name) 256 error['messages'] = err_messages 257 elif isinstance(field, models.fields.DateTimeField): 258 parts = err_field_name.split("_") 259 if parts[-1] in ["date", "time"] and '_'.join(parts[:-1]) == field.name: 260 error['verbose_name'] = capfirst("%s (%s)" % (field.verbose_name, parts[-1])) 261 error['messages'] = err_messages 262 if not error: 263 raise RuntimeError, "verbose field name error not found for: %s" % err_field_name 264 errors.append(error) 265 return {'error_list': errors} 266 error_list = register.inclusion_tag('admin/error_list.html')(error_list) -
django/contrib/admin/templates/admin/error_list.html
1 {% load admin_modify %} 2 <div class="error-list"> 3 <dl> 4 {% for error in error_list %} 5 <dt>{{ error.verbose_name }}</dt> 6 {% for message in error.messages %} 7 <dd>{{ message }}</dd> 8 {% endfor %} 9 {% endfor %} 10 </dl> 11 </div> -
django/contrib/admin/templates/admin/change_form.html
31 31 <p class="errornote"> 32 32 {% blocktrans count form.error_dict.items|length as counter %}Please correct the error below.{% plural %}Please correct the errors below.{% endblocktrans %} 33 33 </p> 34 {% error_list opts.fields form.error_dict %} 34 35 {% endif %} 35 36 {% for bound_field_set in bound_field_sets %} 36 37 <fieldset class="module aligned {{ bound_field_set.classes }}">