Ticket #17921: base_form_css_class.diff

File base_form_css_class.diff, 1.1 KB (added by Haisheng HU, 13 years ago)

add error_css_class and required_css_class to BaseForm's init method

  • django/forms/forms.py

     
    7171    # class, not to the Form class.
    7272    def __init__(self, data=None, files=None, auto_id='id_%s', prefix=None,
    7373                 initial=None, error_class=ErrorList, label_suffix=':',
    74                  empty_permitted=False):
     74                 empty_permitted=False, error_css_class='error',
     75                 required_css_class='required'):
    7576        self.is_bound = data is not None or files is not None
    7677        self.data = data or {}
    7778        self.files = files or {}
     
    8384        self.empty_permitted = empty_permitted
    8485        self._errors = None # Stores the errors after clean() has been called.
    8586        self._changed_data = None
     87        self.error_css_class = error_css_class
     88        self.required_css_class = required_css_class
    8689
    8790        # The base_fields class attribute is the *class-wide* definition of
    8891        # fields. Because a particular *instance* of the class might want to
Back to Top