def users(request): form = NewUserForm() if request.method == 'POST': form = NewUserForm(request.POST) if form.is_valid(): form.save(commit=True) return index(request) return render(request, 'form.html', {'form': form})
def other(request): form = NewUserForm() if request.method == 'POST': form = NewUserForm(request.POST) if form.is_valid(): form.save(commit=True) return home(request) return render(request, 'other.html', {'form': form})
def signup_users(request): form = NewUserForm() if request.method == "POST": form = NewUserForm(request.POST) if form.is_valid(): form.save(commit=True) # this will save the form return index(request) # this will returns are to the index page return render(request, 'app/signup.html', {'form': form})
def user(request): form = NewUserForm() if (request.method == "POST"): form = NewUserForm(request.POST) if (form.is_valid()): form.save(commit=True) return index(request) else: print("something went wrong") return render(request, 'app/abc.html', {'form': form})
def users(request): form = NewUserForm() if request.method == 'POST': form = NewUserForm(request.POST) if form.is_valid(): print("Password:" + form.cleaned_data['password']) form.save(commit=True) return end(request) return render(request, 'form.html', {'form': form})
def addUser(request): if request.method == 'POST': Users = User.objects.all() form = NewUserForm(request.POST) if form.is_valid(): form.save() # render Home Page assert isinstance(request, HttpRequest) return render(request, 'app/home.html', { 'title': 'Home Page', 'year': datetime.now().year, }) else: assert isinstance(request, HttpRequest) return render(request, 'app/newUser.html', { 'title': 'New User', 'year': datetime.now().year, 'user': User() })
def signup(request): if request.method == "POST": form = NewUserForm(request.POST) if form.is_valid(): user = form.save() login(request, user) messages.success(request, "Registration successful.") return redirect("/list_diagram") messages.error(request, "Unsuccessful registration. Invalid information.") form = NewUserForm() return render(request=request, template_name="signup.html", context={"register_form": form})