Added CustomUser.DoesNotExist error exception

This commit is contained in:
M.Ravi 2017-06-22 13:40:39 +05:30
parent 31c389e72c
commit 5caa79f199

View file

@ -329,8 +329,9 @@ class PaymentOrderView(FormView):
vm_template_id = template.get('id', 1)
final_price = specs.get('price')
token = form.cleaned_data.get('token')
try:
custom_user = CustomUser.objects.get(email=user.get('email'))
if custom_user is None:
except CustomUser.DoesNotExist:
password = CustomUser.get_random_password()
# Register the user, and do not send emails
CustomUser.register(user.get('name'),