import logging
from django.contrib.auth import authenticate, login
from django.contrib.auth.mixins import LoginRequiredMixin
from django.urls import reverse
from django.views import generic
from django.views.generic import TemplateView
from account import forms
logger = logging.getLogger(__name__)
[docs]class ProfileView(LoginRequiredMixin, TemplateView):
"""
View the authenticated user's profile.
"""
template_name = 'account/profile.html'
[docs]class SignUpView(generic.FormView):
"""
View to register new users.
"""
form_class = forms.SignUpForm
template_name = 'registration/signup.html'
[docs] def get_success_url(self):
"""
Get the URL that the user is redirected to after submitting the
form.
Returns:
The URL provided in the 'next' parameter or the URL of the
user's profile if no redirect URL is provided.
"""
return self.request.GET.get(
'next',
reverse('account:profile'),
)