0% found this document useful (0 votes)
3 views1 page

User Registration View in Django

The document outlines a Django view function for user sign-up. It checks for required fields, validates password confirmation, and attempts to create a new client record in the database. If successful, it redirects to the sign-in page; otherwise, it handles errors and redirects back to the sign-up page.

Uploaded by

yamenigabin49
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views1 page

User Registration View in Django

The document outlines a Django view function for user sign-up. It checks for required fields, validates password confirmation, and attempts to create a new client record in the database. If successful, it redirects to the sign-in page; otherwise, it handles errors and redirects back to the sign-up page.

Uploaded by

yamenigabin49
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

def signUpView(request):

if [Link] == 'POST':
nom = [Link]('nom_user')
email = [Link]('e_mail')
num_tel = [Link]('num_tel')
pwd = [Link]('pwd')
confirm_pwd = [Link]('confirm_pwd')

if not nom or not email or not num_tel or not pwd or not confirm_pwd:
[Link](request, "All fields are required.")
return redirect('signUpClient')

if pwd != confirm_pwd:
[Link](request, "Passwords do not match.")
return redirect('signUpClient')

try:
[Link](nom_user=nom, email=email, num_tel=num_tel, pwd=pwd)
[Link](request, "Client registered successfully!")
return redirect('signIn')
except Exception as e:
[Link](request, f"An error occurred: {e}")
return redirect('signUpClient')
return render(request, '[Link]')

You might also like