def index(request): #return HttpResponse("My Second App") commit_data = requests.get( "https://api.github.com/repos/Pawel-9215/TerminalDungeon/commits/master" ).content commit_data_loaded = json.loads(commit_data) last_commit_date = commit_data_loaded["commit"]["author"]["date"][0:10] last_commit_msg = commit_data_loaded["commit"]["message"] form = NewUserForm() button_s = True if request.method == 'POST': form = NewUserForm(request.POST) if form.is_valid(): form.save(commit=True) form = "Thank you for subscribing!" button_s = False else: print("ERR in form") index_dick = { 'form': form, 'button': button_s, 'commit_date': last_commit_date, 'commit_msg': last_commit_msg } return render(request, "AppTwo/index.html", index_dick)
def addusers(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 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 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(): form.save(commit=True) return index(request) else: print("Invalid form submission") return render(request, 'users.html', {'form': form})
def users(request): form = NewUserForm() if request.method == 'POST': form = NewUserForm(request.POST) if form.is_valid(): form.save() return index(request) # Redirect to the index page. else: print('Error: Form 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(): form.save(commit=True) return indexA(request) else: print("ERROR FORM INVALID") return render(request, 'form/form.html', {'form': form})
def signup(request): 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/signup.html', {'form': form})
def users_page(request): form = NewUserForm() if request.method == "POST": form = NewUserForm(request.POST) if form.is_valid(): form.save(commit=True) return index_page(request) else: print("ERROR: form invalid") return render(request, 'AppTwo/users.html', context={'form': form})
def NewUser(request): form = NewUserForm() if request.method == "POST": form = NewUserForm(request.POST) print("fprm NewUserForm, method POST") if form.is_valid(): form.save(commit=True) return index(request) print("FORM valid and verified and data commited") else: print('INVALID FORM') return render(request, 'AppTwo/register.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('ERROR FROM INVALID') return render(request, 'AppTwo/user.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: raise ValidationError('error form invalid') return render(request, 'AppTwo/users.html', {'form': form})
def view_users(request): # user_list = User.objects.order_by('last_name') # user_data = {'user_list' : user_list} # return render(request,'AppTwo/users.html', context = user_data) 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 INVALID') return render(request, 'AppTwo/users.html', {'form': form})
def signup(request): form = NewUserForm() if request.method == 'POST': #if someone hit the submit button form = NewUserForm(request.POST) if form.is_valid(): form.save(commit=True) return index(request) #return to homepage else: print('Error form invalid') return render(request, 'sec_app/sign_up.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: return ('Error: invalid form') return render(request, 'users/index.html', {'form': form})
def detail(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 invalid') return render(request, 'AppTwo/detail.html', {'form': form})
def users(request): form = NewUserForm() # after submission the form if request.method == 'POST': form = NewUserForm(request.POST) # printing the values of the form fields if form.is_valid(): form.save(commit=True) return index(request) else: print("Invalid!") return render(request,'AppTwo/user.html',{'form':form})
def user(request): form = NewUserForm() if request.method == 'POST': form = NewUserForm(request.POST) # commit to database and take you back to home page if form.is_valid(): form.save(commit=True) return index(request) else: print('ERROR form invalid') return render(request,'AppTwo/users.html',{'form':form})
def new_user(req): form = NewUserForm() if req.method == 'POST': form = NewUserForm(req.POST) if form.is_valid(): form.save(commit=True) return index(req) else: print('ERROR FORM INVALID') return render(req, 'AppTwo/AppTwo.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 INVALID") return render(request, "appTwo/help.html", {'form': form})
def signup(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/signup.html', {'form': form})
def users(request): form = NewUserForm() if request.method == 'POST': form = forms.NewUserForm(request.POST) if form.is_valid(): #DO SOMETHING LANGUAGE_CODE form.save(commit=True) return index(request) else: print('ERROR FORM INVALID') return render(request, 'AppTwo/user.html', {'form': form})
def users(request): # user_list = User.objects.order_by('FirstName') # user_dict = {'users':user_list} # return render(request,'AppTwo/users.html',context=user_dict) 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 Invalid") return render(request, 'AppTwo/users.html', {'form': form})
def users(request): # user_list = User.objects.order_by('LastName') # user_dict = {'users': user_list} # return render(request, 'AppTwo/user.html', context=user_dict) f = NewUserForm() if request.method == 'POST': f = NewUserForm(request.POST) if f.is_valid(): f.save(commit=True) return index(request) else: print('ERROR FOR IS INVALID') return render(request, 'AppTwo/users.html', {'form': f})
def signup(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 INVALID") return render(request,"AppTwo/signup.html",{'form':form})
def users(request): form = NewUserForm() if request.method == "POST": form = NewUserForm(request.POST) # checks if input information was entered in correctly if form.is_valid(): form.save(commit=True) # return the index view of the request/ take you back to the homepage return index(request) else: print('ERROR FORM INVALAD') return render(request, 'AppTwo/users.html', {'form': form})
def users(request): # user_list=User.objects.order_by("first_name") # user_dict={"user":user_list} # return render(request,'AppTwo/user.html',context=user_dict) form = NewUserForm() if request.method == "POST": #Someone hit submit and sends the information back form = NewUserForm(request.POST) if form.is_valid(): form.save(commit=True) return index(request) # Take back to the home page else: print('ERROR FORM INVALID') return render(request, 'AppTwo/user.html', {'form': form})
def users(request): # users = User.objects.order_by('email') # user_dict = {'user_records' : users} # return render(request, 'AppTwo/users.html', context=user_dict) 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 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(): form.save(commit=True) return index(request) #TODO else: print('ERROR COUNTERED !') 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(): form.save(commit=True) # saves to the db return index(request) # redirect to index page # print("first:" + form.cleaned_data['first_name']) # print("Last:" + form.cleaned_data['last_name']) # print("email:" + form.cleaned_data['email']) else: print("ERROR FORM INVALID") return render(request, 'AppTwo/model_form.html', {'form': form})
def show_user_info(request): """ user_list = User.objects.order_by('first_name') user_dict = {'userinfo': user_list} return render(request, "AppTwo/showuserinfo.html", context=user_dict) """ form = NewUserForm() if request.method == "POST": form = NewUserForm(request.POST) if form.is_valid(): form.save(commit=True) return default(request) else: print('Error form invalid') return render(request, "AppTwo/showuserinfo.html", context={'form': form})