Can't get uuid value in email body in django
I have authentication app with email verification in it. I send an email like this:
If registration form is valid then we save the form(create user) and set his token to uuid.uuid4
.
class customer_register(CreateView):
model = User
form_class = CustomerSignUpForm
template_name = 'authentication/customer_register.html'
def form_valid(self, form):
user = form.save()
user.token = str(uuid.uuid4)
subject = 'Verify your account | Zane'
message = f"http://127.0.0.1:8000/verify/{user.token}/"
send_mail(
subject,
message,
'from@example.com',
['to@example.com'],
fail_silently=False,
)
In my mailtrap.io email arrives but it has some weird body:
http://127.0.0.1:8000/verify/<function uuid4 at 0x103f32040>/
Please use str(uuid.uuid4())
instead of str(uuid.uuid4)