# Django authentication - basic question

**URL:** <https://forum.djangoproject.com/t/django-authentication-basic-question/17377>\
**Category:** Using the ORM\
**Created:** [November 30, 2022, 7:53pm UTC](https://forum.djangoproject.com/t/django-authentication-basic-question/17377 "2022-11-30T19:53:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![julianov](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/julianov/32/3502_2.png) [@julianov](https://forum.djangoproject.com/u/julianov)\
**Post date:** [November 30, 2022, 7:53pm UTC](https://forum.djangoproject.com/t/django-authentication-basic-question/17377/1 "2022-11-30T19:53:22Z")

</div>

Hello.

Using authentication system by django documentation:

> **[Django](https://docs.djangoproject.com/en/4.1/topics/auth/default/#user-objects)**
>
> The web framework for perfectionists with deadlines.

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?

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [November 30, 2022, 8:00pm UTC](https://forum.djangoproject.com/t/django-authentication-basic-question/17377/2 "2022-11-30T20:00:33Z")

</div>

You would want to use a [custom User model](https://docs.djangoproject.com/en/4.1/topics/auth/customizing/#substituting-a-custom-user-model).

The `authenticate` method is not a method on `Model`. (It doesn’t make sense to refer to `client.authenticate`, unless you create the `authenticate` method on `client`.)

Trying to use a custom user model without registering it to the system is possible, but you’ll have to supply your own middleware and backends for it. There are very few situations where that would be advisable or desirable.

Side Note: I strongly suggest you adopt the Django coding conventions and capitalize the class name.
