mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-06 13:30:12 +03:00
allow context to be set even after initialization
This commit is contained in:
parent
0e039402b2
commit
39658f1bf4
|
@ -134,6 +134,14 @@ class BaseSerializer(Field):
|
|||
list_serializer_class = getattr(meta, 'list_serializer_class', ListSerializer)
|
||||
return list_serializer_class(*args, **list_kwargs)
|
||||
|
||||
'''
|
||||
HACK to pass context down to child serializers in rippling.
|
||||
The right way might be to remove @cached_property from fields.py
|
||||
and set self._context here
|
||||
'''
|
||||
def set_context(self, context):
|
||||
self.context = context;
|
||||
|
||||
def to_internal_value(self, data):
|
||||
raise NotImplementedError('`to_internal_value()` must be implemented.')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user