SHARE
TWEET

Untitled

a guest Jun 25th, 2019 56 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. urlpatterns = [
  2.     url(r'^auth/verify/(?P<verification_hash>[0-9A-z-]+)/$', VerifyUserView.as_view(), name='verify_user'),
  3. ]
  4.  
  5.  
  6. class VerifyUserView(generics.UpdateAPIView):
  7.     from .serializers import VerificationHashSerializer
  8.     serializer_class = VerificationHashSerializer
  9.     lookup_field = "verification_hash"
  10.  
  11.     def get_queryset(self):
  12.         from iceberg.models import VerificationHash
  13.         verification_hash = self.kwargs.get('verification_hash')
  14.         token = VerificationHash.objects.get(verification_hash=verification_hash)
  15.         return token
  16.  
  17.     def perform_update(self, serializer: VerificationHashSerializer):
  18.         from iceberg.models import VerificationHash
  19.         verification_hash = self.kwargs.get('verification_hash')
  20.         token = VerificationHash.objects.get(verification_hash=verification_hash)
  21.         token.active = False
  22.         token.save()
  23.         token.user.active = True
  24.         token.user.save()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top