User Register
Submodules
views module
This module contains the view for user registration in the web application.
It provides a view function, register, that handles the registration process using a custom registration form (RegisterForm).
- register.views.register(response: HttpRequest) HttpResponse[source]
Render the registration form and handle form submission.
The registration form is validated upon submission. If the form is valid, the user is saved and redirected to the main view. If the form is invalid, any errors are printed and the user remains on the registration page.
Parameters
- responseHttpRequest
The incoming HTTP request.
Returns
- HttpResponse
The HTTP response with the rendered registration template.
urls module
This module contains the URL configuration for the registration app.
It defines a single URL pattern for the user registration view, using the register view function from the views module.
models module
forms module
This module defines a custom registration form for user sign-up, extending the built-in Django UserCreationForm.
The custom form adds additional fields (email, first_name, and last_name) to the standard registration form.
- class register.forms.RegisterForm(*args, **kwargs)[source]
Bases:
UserCreationForm- class Meta[source]
Bases:
object- fields = ['username', 'email', 'first_name', 'last_name', 'password1', 'password2']
- model
alias of
User
- base_fields = {'email': <django.forms.fields.EmailField object>, 'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>, 'password1': <django.forms.fields.CharField object>, 'password2': <django.forms.fields.CharField object>, 'username': <django.forms.fields.CharField object>}
- declared_fields = {'email': <django.forms.fields.EmailField object>, 'first_name': <django.forms.fields.CharField object>, 'last_name': <django.forms.fields.CharField object>, 'password1': <django.forms.fields.CharField object>, 'password2': <django.forms.fields.CharField object>}
- property media
Return all media required to render the widgets on this form.