Am creating a login screen using django form but failing to get the concept on how can i query from the database to get the user verified as a registered user. I want that a user is validated and displayed with his/her profile as well update his/her profile. The user can view only the allowed pages not viewing other pages.
Here is my model for registering users and the form.
class User(models.Model):
title = models.ForeignKey(Title)
first_name = models.CharField(max_length=100)
last_name = models.CharField(max_length=100)
address = models.TextField()
roles = models.ManyToManyField(Role)
username = models.CharField(max_length=30)
password = models.CharField(max_length=30)
date_added = models.DateTimeField()
def __unicode__(self):
return '%s %s %s' %(self.title, self.first_name, self.last_name)
class UserForm(ModelForm):
date_added=forms.DateField()
class Meta:
model = User
class User(forms.Form):
username = models.CharField(max_length=30)
password = models.CharField(max_length=30)