mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-28 08:59:54 +03:00
Fix framework deprecation warning in test
This commit is contained in:
parent
d09a612863
commit
91563bab6e
|
@ -565,11 +565,10 @@ class TestCreateOnlyDefault:
|
|||
on the callable if possible
|
||||
"""
|
||||
class TestCallableDefault:
|
||||
def set_context(self, serializer_field):
|
||||
self.field = serializer_field
|
||||
requires_context = True
|
||||
|
||||
def __call__(self):
|
||||
return "success" if hasattr(self, 'field') else "failure"
|
||||
def __call__(self, field=None):
|
||||
return "success" if field is not None else "failure"
|
||||
|
||||
class TestSerializer(serializers.Serializer):
|
||||
context_set = serializers.CharField(default=serializers.CreateOnlyDefault(TestCallableDefault()))
|
||||
|
|
Loading…
Reference in New Issue
Block a user