Loading AUTHORS +1 −0 Original line number Diff line number Diff line Loading @@ -510,6 +510,7 @@ answer newbie questions, and generally made Django that much better: polpak@yahoo.com Ross Poulton <ross@rossp.org> Mihai Preda <mihai_preda@yahoo.com> Nick Presta <nick@nickpresta.ca> Matthias Pronk <django@masida.nl> Jyrki Pulliainen <jyrki.pulliainen@gmail.com> Thejaswi Puthraya <thejaswi.puthraya@gmail.com> Loading django/forms/forms.py +5 −2 Original line number Diff line number Diff line Loading @@ -280,7 +280,7 @@ class BaseForm(object): field -- i.e., from Form.clean(). Returns an empty ErrorList if there are none. """ return self.errors.get(NON_FIELD_ERRORS, self.error_class()) return self.errors.get(NON_FIELD_ERRORS, self.error_class(error_class='nonfield')) def _raw_value(self, fieldname): """ Loading Loading @@ -331,6 +331,9 @@ class BaseForm(object): if field != NON_FIELD_ERRORS and field not in self.fields: raise ValueError( "'%s' has no field named '%s'." % (self.__class__.__name__, field)) if field == NON_FIELD_ERRORS: self._errors[field] = self.error_class(error_class='nonfield') else: self._errors[field] = self.error_class() self._errors[field].extend(error_list) if field in self.cleaned_data: Loading django/forms/utils.py +11 −1 Original line number Diff line number Diff line Loading @@ -80,6 +80,14 @@ class ErrorList(UserList, list): """ A collection of errors that knows how to display itself in various formats. """ def __init__(self, initlist=None, error_class=None): super(ErrorList, self).__init__(initlist) if error_class is None: self.error_class = 'errorlist' else: self.error_class = 'errorlist {}'.format(error_class) def as_data(self): return ValidationError(self.data).error_list Loading @@ -99,8 +107,10 @@ class ErrorList(UserList, list): def as_ul(self): if not self.data: return '' return format_html( '<ul class="errorlist">{0}</ul>', '<ul class="{0}">{1}</ul>', self.error_class, format_html_join('', '<li>{0}</li>', ((force_text(e),) for e in self)) ) Loading docs/releases/1.8.txt +4 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,10 @@ Forms the ``<label>`` tags for required fields will have this class present in its attributes. * The rendering of non-field errors in unordered lists (``<ul>``) now includes ``nonfield`` in its list of classes to distinguish them from field-specific errors. * :class:`~django.forms.Field` now accepts a :attr:`~django.forms.Field.label_suffix` argument, which will override the form's :attr:`~django.forms.Form.label_suffix`. This enables customizing the Loading docs/topics/forms/index.txt +11 −0 Original line number Diff line number Diff line Loading @@ -292,6 +292,17 @@ over them:: </ol> {% endif %} .. versionchanged:: 1.8 Non-field errors (and/or hidden field errors that are rendered at the top of the form when using helpers like ``form.as_p()``) will be rendered with an additional class of ``nonfield`` to help distinguish them from field-specific errors. For example, ``{{ form.non_field_errors }}`` would look like:: <ul class="errorlist nonfield"> <li>Generic validation error</li> </ul> Looping over the form's fields ------------------------------ Loading Loading
AUTHORS +1 −0 Original line number Diff line number Diff line Loading @@ -510,6 +510,7 @@ answer newbie questions, and generally made Django that much better: polpak@yahoo.com Ross Poulton <ross@rossp.org> Mihai Preda <mihai_preda@yahoo.com> Nick Presta <nick@nickpresta.ca> Matthias Pronk <django@masida.nl> Jyrki Pulliainen <jyrki.pulliainen@gmail.com> Thejaswi Puthraya <thejaswi.puthraya@gmail.com> Loading
django/forms/forms.py +5 −2 Original line number Diff line number Diff line Loading @@ -280,7 +280,7 @@ class BaseForm(object): field -- i.e., from Form.clean(). Returns an empty ErrorList if there are none. """ return self.errors.get(NON_FIELD_ERRORS, self.error_class()) return self.errors.get(NON_FIELD_ERRORS, self.error_class(error_class='nonfield')) def _raw_value(self, fieldname): """ Loading Loading @@ -331,6 +331,9 @@ class BaseForm(object): if field != NON_FIELD_ERRORS and field not in self.fields: raise ValueError( "'%s' has no field named '%s'." % (self.__class__.__name__, field)) if field == NON_FIELD_ERRORS: self._errors[field] = self.error_class(error_class='nonfield') else: self._errors[field] = self.error_class() self._errors[field].extend(error_list) if field in self.cleaned_data: Loading
django/forms/utils.py +11 −1 Original line number Diff line number Diff line Loading @@ -80,6 +80,14 @@ class ErrorList(UserList, list): """ A collection of errors that knows how to display itself in various formats. """ def __init__(self, initlist=None, error_class=None): super(ErrorList, self).__init__(initlist) if error_class is None: self.error_class = 'errorlist' else: self.error_class = 'errorlist {}'.format(error_class) def as_data(self): return ValidationError(self.data).error_list Loading @@ -99,8 +107,10 @@ class ErrorList(UserList, list): def as_ul(self): if not self.data: return '' return format_html( '<ul class="errorlist">{0}</ul>', '<ul class="{0}">{1}</ul>', self.error_class, format_html_join('', '<li>{0}</li>', ((force_text(e),) for e in self)) ) Loading
docs/releases/1.8.txt +4 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,10 @@ Forms the ``<label>`` tags for required fields will have this class present in its attributes. * The rendering of non-field errors in unordered lists (``<ul>``) now includes ``nonfield`` in its list of classes to distinguish them from field-specific errors. * :class:`~django.forms.Field` now accepts a :attr:`~django.forms.Field.label_suffix` argument, which will override the form's :attr:`~django.forms.Form.label_suffix`. This enables customizing the Loading
docs/topics/forms/index.txt +11 −0 Original line number Diff line number Diff line Loading @@ -292,6 +292,17 @@ over them:: </ol> {% endif %} .. versionchanged:: 1.8 Non-field errors (and/or hidden field errors that are rendered at the top of the form when using helpers like ``form.as_p()``) will be rendered with an additional class of ``nonfield`` to help distinguish them from field-specific errors. For example, ``{{ form.non_field_errors }}`` would look like:: <ul class="errorlist nonfield"> <li>Generic validation error</li> </ul> Looping over the form's fields ------------------------------ Loading