I want to create the inactive user and send them activation email. This is my view:
secret = hexlify(os.urandom(6))
userName = form.cleaned_data['email']
if User.objects.filter(username=userName):
message = EmailMessage('portal/pay_email2.html',{'refid':pk, 'amount':total,'Payment':Payment,'secret': secret }, 'Madeeha ', to=[form.cleaned_data['email']])
message.send()
else:
userPass = hexlify(os.urandom(4))
userMail = form.cleaned_data['email']
user = User.objects.create_user(userName, userMail,userPass)
user.save()
message = EmailMessage('portal/pay_email.html',{'refid':pk, 'amount':total,'Payment':Payment,'userName':userName, 'userPass':userPass, 'secret': secret }, 'Madeeha ', to=[form.cleaned_data['email']])
message.send()