summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
authorCarlton Gibson <carlton.gibson@noumenal.es>2020-01-07 11:52:09 +0100
committerCarlton Gibson <carlton.gibson@noumenal.es>2020-01-15 15:36:28 +0100
commit57468eaff3de78918be5fb15a7984e49d7d3d103 (patch)
treeee54fe217fa01c831a7cadb90ae12780db59311c /docs/ref
parent8712027b226f1400ea31f9c0500fbfe359dd9d07 (diff)
[3.0.x] Fixed #31124 -- Fixed setting of get_FOO_display() when overriding inherited choices.
Regression in 2d38eb0ab9f78d68c083a5b78b1eca39027b279a Backport of 29c126bb349526b5f1cd78facbe9f25906f18563 from master
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/models/instances.txt9
1 files changed, 9 insertions, 0 deletions
diff --git a/docs/ref/models/instances.txt b/docs/ref/models/instances.txt
index db9e62e8e0..db88cdff0a 100644
--- a/docs/ref/models/instances.txt
+++ b/docs/ref/models/instances.txt
@@ -829,6 +829,15 @@ Note that in the case of identical date values, these methods will use the
primary key as a tie-breaker. This guarantees that no records are skipped or
duplicated. That also means you cannot use those methods on unsaved objects.
+.. admonition:: Overriding extra instance methods
+
+ In most cases overriding or inheriting ``get_FOO_display()``,
+ ``get_next_by_FOO()``, and ``get_previous_by_FOO()` should work as
+ expected. Since they are added by the metaclass however, it is not
+ practical to account for all possible inheritance structures. In more
+ complex cases you should override ``Field.contribute_to_class()`` to set
+ the methods you need.
+
Other attributes
================