Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

Untitled

a guest Jun 14th, 2018 80 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. from django.template import RequestContext
  2. from django.shortcuts import render_to_response
  3. from django.http import HttpResponseRedirect, HttpResponse
  4. from django.core.urlresolvers import reverse
  5. from django import forms
  6.  
  7. def login(request):
  8.     if request.method == 'POST': #if the form has been submitted...
  9.         form = ContactForm(request.POST) # form bount to the POST data
  10.         if form.is_valid(): # all validation rules pass
  11.             # process teh data in form.cleaned_data
  12.             # ...
  13.             return HttpResponseRedirect ('/main/') # redirect after post
  14.     else:
  15.         form = ContactForm() # unbound form
  16.  
  17.     return render_to_response ("login.html", {
  18.         'form' : form, }, context_instance = RequestContext (request))
  19.  
  20. def main_page(request):
  21.     return HttpResponse("WOOHOO")
  22.  
  23. class ContactForm(forms.Form):
  24.     Username = forms.CharField(max_length = 100)
  25.     Password = forms.CharField(label = (u'Password'), widget = forms.PasswordInput(render_value = False))
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top