Views

class users.views.MyLoginView(**kwargs)[source]

Bases: LoginView

LogIn class.

The class has the following attributes:

  • template_name (str): The name of the template.

  • next_page (str): The URL to redirect to after a successful login.

next_page = '/'
template_name = 'users/login.html'
class users.views.MyLogoutView(**kwargs)[source]

Bases: LogoutView

LogOut class.

The class has the following attributes:

  • next_page (str): The URL to redirect to after a successful logout.

next_page = '/'
class users.views.MyRegistrationView(**kwargs)[source]

Bases: View

Class for user registration.

get(request)[source]

Render the registration page with the form.

Parameters:

request – request object

Returns:

render

post(request)[source]

Register a new user. Redirect to the main page if the form is valid. Render the registration page with the form if the form is not valid.

Parameters:

request – request object

Returns:

render or redirect

class users.views.MyResetPasswordView(**kwargs)[source]

Bases: PasswordResetView

Class for reset password. NOT WORKING NOW.

The class has the following attributes:

  • template_name (str): The name of the template.

  • email_template_name (str): The name of the email template.

  • html_email_template_name (str): The name of the html email template.

  • success_url (str): The URL to redirect to after a successful password reset.

  • success_message (str): The message that will be displayed after a successful password reset.

  • subject_template_name (str): The name of the subject template.

email_template_name = 'users/password_reset_email.html'
html_email_template_name = 'users/password_reset_email.html'
subject_template_name = 'users/password_reset_subject.txt'
success_message = 'An email with instructions to reset your\n                        password has been sent to %(email)s.'
success_url = '/users/reset-password/done/'
template_name = 'users/password_reset.html'