Hello.
Using authentication system by django documentation:
This is the user model:
class client(models.Model):
id = models.AutoField(primary_key=True)
password = models.CharField(max_length=200)
email = models.EmailField()
email_confirmed = models.BooleanField(default=False)
random_number= models.IntegerField(default=0)
name = models.CharField(max_length=200, blank=True)
last_name = models.CharField(max_length=200, blank=True)
picture=models.ImageField(upload_to='media/', blank=True)
qualification=models.IntegerField(default=0)
cantidad_ordenes_realizadas =models.IntegerField(default=0)
cantidad_ordenes_canceladas =models.IntegerField(default=0)
def __str__(self):
return self.email
Can I implement something like this?
user = authenticate(username='john', password='secret')
if user is not None:
# A backend authenticated the credentials
else:
# No backend authenticated the credentials
for client model.
user = client.authenticate(username='john', password='secret')
Or should I use the user model?