Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- models.py
- from django.db import models
- #from django.contrib.auth.models import User
- class Users(models.Model):
- username = models.TextField()
- password = models.TextField()
- views.py
- from django.contrib.auth import authenticate, login
- from django.http import HttpResponseRedirect
- def login(request):
- username = request.POST['username']
- password = request.POST['password']
- user = authenticate(username=username,password=password)
- if user is not None:
- #check the level of the user and redirect to the website
- if user.is_active:
- return HttpResponseRedirect('index.html')
- else:
- print "error account"
- else:
- print "error acount login"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement