sign code example
Example 1: signup
class SignUpView(CreateView):
form_class = UserCreationForm
success_url = reverse_lazy('login')
template_name = 'registration/signup.html'
def form_valid(self, form):
view = super(SignUpView, self).form_valid(form)
username = form.cleaned_data.get('username')
password = form.cleaned_data.get('password1')
user = authenticate(username=username, password=password)
login(self.request, user)
return view
Example 2: out
<!DOCTYPE html>
<html>
<body style="background-color:powderblue;">
</body>
</html>