djangodocs.org

704 sections in Django dev Search all versions →

Model validation

Release notes Django 1.2 release notes

Model instances now have support for validating their own data, and both model and form fields now accept configurable lists of validators specifying reusable, encapsulated validation behavior. Note, however, that validation must still be performed explicitly.

Forms

Release notes Django 1.10 release notes

Form and widget Media is now served using django.contrib.staticfiles if installed. The <input> tag rendered by CharField now includes a minlength attribute if the field has a min_length. Required form fields now have the required HTML attribute.

Error metadata

Release notes Django 1.7 release notes

The ValidationError constructor accepts metadata such as error code or params which are then available for interpolating into the error message (see Raising ValidationError for more details); however, before Django 1.7 those metadata were discarded as soon as the errors …

Bugfixes

Release notes Django 1.10.2 release notes

Fixed a crash in MySQL database validation where SELECT @@sql_mode doesn’t return a result (#27180). Allowed combining contrib.postgres.search.SearchQuery with more than one & or | operators (#27143). Disabled system check for URL patterns beginning with a ‘/’ when APPEND_SLASH=False (#27238).

CZBirthNumberField.clean

Release notes Django 1.3 release notes

Previously this field’s clean() method accepted a second, gender, argument which allowed stronger validation checks to be made, however since this argument could never actually be passed from the Django form machinery it is now pending deprecation.

Minor features

Release notes Django 1.6 release notes

Fields included in the localized_fields list will be localized (by setting localize on the form field). The labels, help_texts and error_messages options may be used to customize the default fields, see Overriding the default fields for details.

Forms

Release notes Django 4.0 release notes

ModelChoiceField now includes the provided value in the params argument of a raised ValidationError for the invalid_choice error message. This allows custom error messages to use the %(value)s placeholder.