def users(request): form = NewUserForm() if request.method == "POST": form = NewUserForm(request.POST) if form.is_valid(): form.save(commit=True) return index(request) else: print('Error from invalid') return render(request, 'apptwo/users.html', {'form': form})
def users(request): #this view gets the model, transforms it into a dictionary, then displays it form = NewUserForm() if request.method == 'POST': form = NewUserForm(request.POST) if form.is_valid(): form.save(commit=True) return index(request) else: print('Form invalid') return render(request,'apptwo/users.html',{'form':form})
def signup_form(request): form = NewUserForm() if request.method == 'POST': form = NewUserForm(request.POST) if form.is_valid(): form.save(commit=True) return home(request) else: print('ERROR! FORM INVALID') return render(request, 'apptwo/signup.html', {'form': form})
def users(request): form = NewUserForm() if request.method == "POST": form = NewUserForm(request.POST) if form.is_valid(): form.save(commit=True) return index(request) else: print("ERROR FORM IS INVALID") return render(request, 'apptwo/users.html', {'form': form})
def users(request): form = NewUserForm() if request.method == 'POST': form = NewUserForm(request.POST) if form.is_valid(): print("valid hu") form.save(commit=True) return render(request, 'apptwo/index.html') else: print("Error!!Form is invalid") return render(request, 'apptwo/userinfo.html', {'form': form})
def users(request): form = NewUserForm() if request.method == 'POST': form = NewUserForm(request.POST) if form.is_valid(): form.save(commit=True) return index(request) else: print('Invalid Form') return render(request, 'apptwo/users.html', context={'form': form})
def user(request): # userlist = users.objects.order_by('firstname') # userdict = {'users':userlist} # return render(request,'apptwo/users.html', context=userdict) form = NewUserForm() if request.method == 'POST': form = NewUserForm(request.POST) if form.is_valid(): form.save(commit=True) messages.success(request, 'We have recieved your Data! Thanks for Trying.') return HttpResponseRedirect(reverse('index')) else: print('ERROR FORM INVALID.') return render(request, 'apptwo/users.html', {'form': form})