mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
Refs #26351 -- Added check hook to support database-related checks
Thanks Tim Graham and Shai Berger for the reviews.
This commit is contained in:
@@ -120,17 +120,22 @@ The code below is equivalent to the code above::
|
||||
|
||||
.. _field-checking:
|
||||
|
||||
Field, model, and manager checks
|
||||
--------------------------------
|
||||
Field, model, manager, and database checks
|
||||
------------------------------------------
|
||||
|
||||
In some cases, you won't need to register your check function -- you can
|
||||
piggyback on an existing registration.
|
||||
|
||||
Fields, models, and model managers all implement a ``check()`` method that is
|
||||
already registered with the check framework. If you want to add extra checks,
|
||||
you can extend the implementation on the base class, perform any extra
|
||||
checks you need, and append any messages to those generated by the base class.
|
||||
It's recommended that you delegate each check to separate methods.
|
||||
Fields, models, model managers, and database backends all implement a
|
||||
``check()`` method that is already registered with the check framework. If you
|
||||
want to add extra checks, you can extend the implementation on the base class,
|
||||
perform any extra checks you need, and append any messages to those generated
|
||||
by the base class. It's recommended that you delegate each check to separate
|
||||
methods.
|
||||
|
||||
.. versionchanged:: 1.10
|
||||
|
||||
Database backend checks were added.
|
||||
|
||||
Consider an example where you are implementing a custom field named
|
||||
``RangedIntegerField``. This field adds ``min`` and ``max`` arguments to the
|
||||
|
||||
Reference in New Issue
Block a user