Registration View

Learn how to create a user registration view.

This lesson focuses on implementing the registration view.

Create the user registration view

We can now create a view for registering users in our views.py. The view class extends the GenericAPIView in the class-based view with a post method. This view class handles all post requests that will be coming in from the user registration endpoint. It is also in the middle of all the registration components, such as the registration endpoint, registration serializer, and the model.

When a request comes in from the endpoint:

  • The registration view passes the user object to the registration serializer.
  • The serializer validates and serializes the user object and passes it back to the registration view.
  • The registration view saves the serialized user object in the database.
  • The registration view retrieves the user instance from the database and deserializes it through the registration serializer.
  • The deserialized user object is passed to the registration endpoint.

Get hands-on with 1200+ tech skills courses.