i am new to django and concept i am trying is very simple. I created the custom model(i dont want to extend any pre-defined model). And using this code i tried to authenticate my login :
Models.py : (i have given just sample data here. This is not the real data i use. And my client dosent want me to use any builtin models like AbstractBaseUser etc.,)
from django.db import models
#from django.contrib.auth.models import User
class logindata(models.Model):
fname= models.CharField(max_length=30)
lname = models.CharField(max_length=30)
uname = models.CharField(max_length=30)
password = models.CharField(max_length = 30)
Views.py
def auth_view(request):
username = request.POST.get('username','')
password = request.POST.get('password','')
user =auth.authenticate(uname=username, password=password)
if user is not None:
auth.login(request, user)
return HttpResponseRedirect('/accounts/loggedin',{'user':user})
else:
return HttpResponseRedirect('/accounts/invalid')
def loggedin(request):
return render_to_response('loggedin.html',
{'name':request.user.uname})
My question is very simple. i want authenticate to look at my custom model(logindata) instead of the default one. how do i do that ??