Advertisement
Guest User

Untitled

a guest
May 21st, 2021
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.32 KB | None | 0 0
  1. from django.shortcuts import render
  2. from django.http import HttpResponse
  3. from django.http import HttpResponseRedirect
  4. from django.shortcuts import redirect
  5. from .models import Trailer
  6. from .forms import NameForm
  7. def index(request):
  8.     return render(request, 'polls/index.html')
  9. def trailers(request):
  10.     return render(request, 'polls/trailers.html')
  11. def about(request):
  12.     return render(request, 'polls/about.html')
  13. def login(request):
  14.     return render(request, 'polls/login.html')
  15. def registration(request):
  16.     return render(request, 'polls/registration.html')
  17. def test(request):
  18.     return render(request, 'polls/test.html')
  19.  
  20. def get_name(request):
  21.     # if this is a POST request we need to process the form data
  22.     if request.method == 'POST':
  23.         # create a form instance and populate it with data from the request:
  24.         form = NameForm(request.POST)
  25.         # check whether it's valid:
  26.         if form.is_valid():
  27.             username = form.cleaned_data['user_user']
  28.             email_user = form.cleaned_data['user_email']
  29.             pass_user = form.cleaned_data['user_pass']
  30.             sender = form.cleaned_data['user_submit']
  31.             return HttpResponseRedirect('test.html')
  32.         else:
  33.             form = NameForm()
  34.  
  35.         return render(request, 'test.html', {'form': form})
  36.  
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement