--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/331219f5-b547-456c-a7c4-759c0574d82b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAJ60hW2T%3DVnYyXGwhaFS-SyK5kg7Voi7at9N-c%2BTiGkpJ4EMVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
"It's when nothing happens that anything can happen."
https://kodenaut.github.io/
+254 723494571
from django.shortcuts import render, redirect
from django.contrib.auth.decorators import login_required
from .forms import UserRegisterForm, UserUpdateForm, ProfileUpdateForm
from django.contrib import messages
from .models import Profile
from quiz.models import Question
def register(request):
if request.method == 'POST':
form = UserRegisterForm(request.POST)
if form.is_valid():
form.save()
username = form.cleaned_data.get('username')
messages.success(request, f'Account Created for {username}!')
return redirect('quiz:quiz-index')
else:
form = UserRegisterForm()
return render(request, 'users/register.html', {'form': form})