Project Challenge: Inserting Users in Sign-Up

In this lesson, we will be modifying the sign-up method to insert users in the database.

Problem statement

In this challenge, we will be modifying the signup view that we made previously. In that function, we were inserting new users into the list. However, now that we have the models created, we should insert the new users into them. Your application should do the following tasks:

  1. Modify the signup view to insert new_user in the database.

  2. If the unique constraint of the email column is violated, then a message should be shown on the template saying, “This email already exists in the system! Please log in instead.”

  3. Handle the above mentioned exception gracefully, i.e. your application should not crash.

Get hands-on with 1200+ tech skills courses.