From b880379c0187d27f06d576ebc297965f1bd0a694 Mon Sep 17 00:00:00 2001 From: ssaid Date: Sun, 17 Sep 2023 20:41:22 -0300 Subject: [PATCH] Update README.md Describe how to adapt the view of DRF --- README.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/README.md b/README.md index 00ee391..3a4fb12 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ Email verification for new signups or new users is a two-step verification proce * Added feature for **re-requesting email** in case the previous email was lost or deleted by mistake * Added a variable `REQUEST_NEW_EMAIL_TEMPLATE` where user can specify his custom template for requesting email again. More on this here. * Added a Django form for requesting email with a field `email`. +* Support for DRF Read about this feature here @@ -391,4 +392,19 @@ After verification is successful, you might want to redirect the user to the log > There is always room for improvements and new ideas, feel free to raise PR or Issues +### DRF Support +Using the latests commit(not yet published in the release of PyPi) you can easily adapt your view to support sending the verification! +```python +from verify_email.email_handler import _VerifyEmail +class UserRegistrationView(generics.CreateAPIView): + queryset = User.objects.all() + serializer_class = UserSerializer + permission_classes = [permissions.AllowAny] + + def perform_create(self, serializer): + instance = serializer.save() + # Send email for verification + _VerifyEmail().send_verification_link(self.request, inactive_user=instance) + instance.save() +```