# Django Admin does not recognize superuser

**URL:** <https://forum.djangoproject.com/t/django-admin-does-not-recognize-superuser/28911>\
**Category:** Mystery Errors\
**Created:** [March 9, 2024, 11:28pm UTC](https://forum.djangoproject.com/t/django-admin-does-not-recognize-superuser/28911 "2024-03-09T23:28:05Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![taborda17](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/taborda17/32/18401_2.png) [@taborda17](https://forum.djangoproject.com/u/taborda17)\
**Post date:** [March 9, 2024, 11:28pm UTC](https://forum.djangoproject.com/t/django-admin-does-not-recognize-superuser/28911/1 "2024-03-09T23:28:06Z")

</div>

well, after creating a superuser for my project and trying to login into admin/, I see the following error:  
 ![Captura de tela 2024-03-09 202508](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/3X/c/5/c58fc2845afc7cb7ea313bb80c930e3a7094a964.png)

my model for users is:

```auto
class User(AbstractUser):
    name = models.CharField(max_length=20,default= None)
    username = models.CharField(max_length=30,unique=True)
    email = models.EmailField(max_length=254, unique=True)
    password = models.CharField(max_length=30)
    is_active = models.BooleanField(default=False)

```

nothing more I think could be sending an error

in admin.py I have:

```auto
from django.contrib import admin
from .models import User 
from django.contrib.auth.admin import UserAdmin

admin.site.register(User)

```

---

<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:** [March 9, 2024, 11:41pm UTC](https://forum.djangoproject.com/t/django-admin-does-not-recognize-superuser/28911/2 "2024-03-09T23:41:20Z")

</div>

That’s the wrong size field for a password. The AbstractBaseUser class defines password as max\_length 128. You should not override that field.

See the docs at [Password management in Django | Django documentation | Django](https://docs.djangoproject.com/en/5.0/topics/auth/passwords/)

Beyond that, if you need further assistance with resolving this, please post the code being used to create these users.

---

<div class="post-metadata">

**Author:** ![taborda17](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/taborda17/32/18401_2.png) [@taborda17](https://forum.djangoproject.com/u/taborda17)\
**Post date:** [March 10, 2024, 12:10am UTC](https://forum.djangoproject.com/t/django-admin-does-not-recognize-superuser/28911/3 "2024-03-10T00:10:20Z")

</div>

I’ve noticed that I don’t even need a field password here. But thank you for this information

---

<div class="post-metadata">

**Author:** ![taborda17](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/taborda17/32/18401_2.png) [@taborda17](https://forum.djangoproject.com/u/taborda17)\
**Post date:** [March 10, 2024, 12:13am UTC](https://forum.djangoproject.com/t/django-admin-does-not-recognize-superuser/28911/4 "2024-03-10T00:13:31Z")

</div>

Anyway it’s not working, same error.
