mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 00:19:53 +03:00
Take default value from 'INCLUDE_REVERSE_RELATIONS' settings
This commit is contained in:
parent
0ff3123f3a
commit
6f36563b92
|
@ -6,6 +6,7 @@ from django.db import models
|
||||||
from django.forms import widgets
|
from django.forms import widgets
|
||||||
from django.utils.datastructures import SortedDict
|
from django.utils.datastructures import SortedDict
|
||||||
from rest_framework.compat import get_concrete_model
|
from rest_framework.compat import get_concrete_model
|
||||||
|
from rest_framework.settings import api_settings
|
||||||
|
|
||||||
# Note: We do the following so that users of the framework can use this style:
|
# Note: We do the following so that users of the framework can use this style:
|
||||||
#
|
#
|
||||||
|
@ -360,7 +361,7 @@ class ModelSerializerOptions(SerializerOptions):
|
||||||
super(ModelSerializerOptions, self).__init__(meta)
|
super(ModelSerializerOptions, self).__init__(meta)
|
||||||
self.model = getattr(meta, 'model', None)
|
self.model = getattr(meta, 'model', None)
|
||||||
self.read_only_fields = getattr(meta, 'read_only_fields', ())
|
self.read_only_fields = getattr(meta, 'read_only_fields', ())
|
||||||
self.include_reverse_relations = getattr(meta, 'include_reverse_relations', False)
|
self.include_reverse_relations = getattr(meta, 'include_reverse_relations', api_settings.INCLUDE_REVERSE_RELATIONS)
|
||||||
|
|
||||||
|
|
||||||
class ModelSerializer(Serializer):
|
class ModelSerializer(Serializer):
|
||||||
|
|
|
@ -55,6 +55,9 @@ DEFAULTS = {
|
||||||
'anon': None,
|
'anon': None,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
# ModelSerializer
|
||||||
|
'INCLUDE_REVERSE_RELATIONS': False,
|
||||||
|
|
||||||
# Pagination
|
# Pagination
|
||||||
'PAGINATE_BY': None,
|
'PAGINATE_BY': None,
|
||||||
'PAGINATE_BY_PARAM': None,
|
'PAGINATE_BY_PARAM': None,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user