summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorovalseven8 <ovalseven8@users.noreply.github.com>2018-03-06 17:18:49 +0100
committerTim Graham <timograham@gmail.com>2018-03-13 12:45:01 -0400
commit22bcd3a1d88add6e4cf2c4451ede8d1ae142dedd (patch)
treee92704deccd3cae706f3cee174d49b0967167b97 /docs
parente17088a108e604cad23b000a83189fdd02a8a2f9 (diff)
downloaddjango-22bcd3a1d88add6e4cf2c4451ede8d1ae142dedd.tar.gz
Fixed #29192 -- Corrected docs regarding overriding fields from abstract base classes.
Diffstat (limited to 'docs')
-rw-r--r--docs/topics/db/models.txt7
1 files changed, 4 insertions, 3 deletions
diff --git a/docs/topics/db/models.txt b/docs/topics/db/models.txt
index 4294c05ec2..74ec4dc230 100644
--- a/docs/topics/db/models.txt
+++ b/docs/topics/db/models.txt
@@ -897,9 +897,7 @@ information into a number of other models. You write your base class
and put ``abstract=True`` in the :ref:`Meta <meta-options>`
class. This model will then not be used to create any database
table. Instead, when it is used as a base class for other models, its
-fields will be added to those of the child class. It is an error to
-have fields in the abstract base class with the same name as those in
-the child (and Django will raise an exception).
+fields will be added to those of the child class.
An example::
@@ -920,6 +918,9 @@ The ``Student`` model will have three fields: ``name``, ``age`` and
model, since it is an abstract base class. It does not generate a database
table or have a manager, and cannot be instantiated or saved directly.
+Fields inherited from abstract base classes can be overridden with another
+field or value, or be removed with ``None``.
+
For many uses, this type of model inheritance will be exactly what you want.
It provides a way to factor out common information at the Python level, while
still only creating one database table per child model at the database level.