A
A
Anton2016-04-15 12:04:20
Django
Anton, 2016-04-15 12:04:20

How to get all the attributes of an object instance?

Hello everyone, there was an authentication problem on the site. When I try to login, it says: invalid password.
Possible problem: either the password is wrong, or the phone number that is specified as the login.
I went into the shell, checked the password - it is correct. But in which property of the User instance the phone number is stored - I don’t know.
Question: how to display all the attributes of an object instance on the command line?
PS: I practically don't know python, I did everything according to the manual, like this:
from django.contrib.auth.models import User
user = User.objects.get(username="my_name")
user.password //-given the correct password
I want this display the phone number in the same way
PS - I apologize for the stupid question, it's just that there is a rather urgent task, there is no time to deal with the documentation of djanga or python for a long time

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Kuts, 2016-04-15
@tunikov

print dir(user)
But in your case, the phone could be stored in another object linked with a ForeignKey to your user.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question