refactor allow VerifyEmailView display data field in swagger

This commit is contained in:
Bang Dao 2016-12-09 16:53:09 +07:00
parent f200b8d6f0
commit d2917e9f3f

View File

@ -69,8 +69,11 @@ class VerifyEmailView(APIView, ConfirmEmailView):
permission_classes = (AllowAny,) permission_classes = (AllowAny,)
allowed_methods = ('POST', 'OPTIONS', 'HEAD') allowed_methods = ('POST', 'OPTIONS', 'HEAD')
def get_serializer(self, *args, **kwargs):
return VerifyEmailSerializer(*args, **kwargs)
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
serializer = VerifyEmailSerializer(data=request.data) serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True) serializer.is_valid(raise_exception=True)
self.kwargs['key'] = serializer.validated_data['key'] self.kwargs['key'] = serializer.validated_data['key']
confirmation = self.get_object() confirmation = self.get_object()