Reputation: 4977
I am learning Django, and i am following the Django tutorials in the djangoproject website. I wanted to use the Django Auth. In the tutorial I saw a reference to a User table which will get created automatically during the 'migrate' if I have all the needed settings. I made sure all the settings are inside the settings.py file and ran migrate. I saw that instead of User table, it is Auth_User got created inside the database. I want to hash the password before storing it in the database, for that I tried using set_password function, which is not available with the Auth_User.
Can any one please tell me the difference between Auth_User and User
Upvotes: 0
Views: 2497
Reputation: 5992
I think your confusion is coming from the fact that User
is a class of the auth
app.
As seen in the Django documentation, the app name is prepended to the start of the table name:
For example, if you have an app bookstore (as created by manage.py startapp bookstore), a model defined as class Book will have a database table named bookstore_book
Upvotes: 0
Reputation: 599630
Methods are defined on the model class, not on the database table. The User class creates a table called "auth_user", because it is inside the auth app. And the set_password
method is available on that model.
Upvotes: 3