Make verify email browsable

This commit is contained in:
Bruno Michetti 2020-06-01 17:53:33 -03:00
parent c5d553dfb1
commit 6cdcbfacd2

View File

@ -19,7 +19,7 @@ from django.utils.decorators import method_decorator
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.views.decorators.debug import sensitive_post_parameters from django.views.decorators.debug import sensitive_post_parameters
from rest_framework import status from rest_framework import status
from rest_framework.exceptions import NotFound from rest_framework.exceptions import NotFound, MethodNotAllowed
from rest_framework.generics import CreateAPIView, GenericAPIView, ListAPIView from rest_framework.generics import CreateAPIView, GenericAPIView, ListAPIView
from rest_framework.permissions import AllowAny, IsAuthenticated from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.response import Response from rest_framework.response import Response
@ -86,6 +86,9 @@ class VerifyEmailView(APIView, ConfirmEmailView):
def get_serializer(self, *args, **kwargs): def get_serializer(self, *args, **kwargs):
return VerifyEmailSerializer(*args, **kwargs) return VerifyEmailSerializer(*args, **kwargs)
def get(self, *args, **kwargs):
raise MethodNotAllowed('GET')
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
serializer = self.get_serializer(data=request.data) serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True) serializer.is_valid(raise_exception=True)