E
E
Egegey2020-11-17 14:11:17
Django
Egegey, 2020-11-17 14:11:17

Why do I see the user's real password in the Django admin?

Why can I see the user's real password in the Django admin and database?
I just inherited from the base model, I did not change the password field.
Am I missing something?
Created users through the admin panel

5fb3af5a243ba166512373.png
5fb3afa3a6d19301871058.png

class ChatUser(AbstractUser):

    GENDER = [
        ('MALE', 'MALE'),
        ('FEMALE', 'FEMALE')
    ]
    is_active = models.BooleanField(default=False)
    gender = models.CharField(verbose_name='Gender', choices=GENDER, max_length=6)
    birthdate = models.DateField(verbose_name='Birthdate', blank=True, null=True)

    def __str__(self):
        return self.username

Answer the question

In order to leave comments, you need to log in

3 answer(s)
N
newvasyuki, 2020-11-17
@Egegey

In admin.py register the model correctly
https://stackoverflow.com/a/15013810

D
Dr. Bacon, 2020-11-17
@bacon

Because there is a separate method for setting the password, and not just assigning a value to the field.

A
AlexandrBirukov, 2020-11-17
@AlexandrBirukov

How is this user created? And specifically how is the password set for it?
you need to explicitly call set_password for this:
user.set_password(пароль)

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question