mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-27 08:29:59 +03:00
feat: pass args/kwargs to get_serializer_class
This commit is contained in:
parent
ad282da97c
commit
7c2784f33b
|
@ -105,11 +105,11 @@ class GenericAPIView(views.APIView):
|
||||||
Return the serializer instance that should be used for validating and
|
Return the serializer instance that should be used for validating and
|
||||||
deserializing input, and for serializing output.
|
deserializing input, and for serializing output.
|
||||||
"""
|
"""
|
||||||
serializer_class = self.get_serializer_class()
|
serializer_class = self.get_serializer_class(*args, **kwargs)
|
||||||
kwargs.setdefault('context', self.get_serializer_context())
|
kwargs.setdefault('context', self.get_serializer_context())
|
||||||
return serializer_class(*args, **kwargs)
|
return serializer_class(*args, **kwargs)
|
||||||
|
|
||||||
def get_serializer_class(self):
|
def get_serializer_class(self, *args, **kwargs):
|
||||||
"""
|
"""
|
||||||
Return the class to use for the serializer.
|
Return the class to use for the serializer.
|
||||||
Defaults to using `self.serializer_class`.
|
Defaults to using `self.serializer_class`.
|
||||||
|
|
Loading…
Reference in New Issue
Block a user