Add docs on Meta inheritance. Closes #1926.

This commit is contained in:
Tom Christie 2014-11-03 15:08:19 +00:00
parent 21d06a4103
commit 78ac332f18

View File

@ -413,6 +413,16 @@ Alternative representations include serializing using hyperlinks, serializing co
For full details see the [serializer relations][relations] documentation. 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 # HyperlinkedModelSerializer