aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorTom Christie2014-11-03 15:08:19 +0000
committerTom Christie2014-11-03 15:08:19 +0000
commit78ac332f18c51bb151ae32f1f3d207595b0b3ca2 (patch)
tree7fc5895865b3558e0ca6c11cc9bacf1abf8caf1e /docs
parent21d06a4103d1966cd6e19f7cc6f3c6e450cc1680 (diff)
downloaddjango-rest-framework-78ac332f18c51bb151ae32f1f3d207595b0b3ca2.tar.bz2
Add docs on Meta inheritance. Closes #1926.
Diffstat (limited to 'docs')
-rw-r--r--docs/api-guide/serializers.md10
1 files changed, 10 insertions, 0 deletions
diff --git a/docs/api-guide/serializers.md b/docs/api-guide/serializers.md
index a3694510..eeeffa13 100644
--- a/docs/api-guide/serializers.md
+++ b/docs/api-guide/serializers.md
@@ -413,6 +413,16 @@ Alternative representations include serializing using hyperlinks, serializing co
For full details see the [serializer relations][relations] documentation.
+## Inheritance of the 'Meta' class
+
+The inner `Meta` class on serializers is not inherited from parent classes by default. This is the same behaviour as with Django's `Model` and `ModelForm` classes. If you want the `Meta` class to inherit from a parent class you must do so explicitly. For example:
+
+ class AccountSerializer(MyBaseSerializer):
+ class Meta(MyBaseSerializer.Meta):
+ model = Account
+
+Typically we would recommend *not* using inheritance on inner Meta classes, but instead declaring all options explicitly.
+
---
# HyperlinkedModelSerializer