When we do, User.objects.all(), it returns a queryset which will show you 
all the objects that are present in the database for the model. So, when 
you print that queryset, it just displays the username of the user.

This is also because the def __str__ method of the User model must be 
returning the username. So, if you want to see all the fields of, check out 
this link: 
https://stackoverflow.com/questions/3106295/django-get-list-of-model-fields

On Friday, July 3, 2020 at 12:05:10 PM UTC+5:30, Mohsen Pahlevanzadeh wrote:
>
> When  I use select * from auth_user; I get the following result:
> ########################################################################
>
> +----+--------------------------------------------------------------------------------+------------+--------------+----------+------------+-----------+--------------------------+----------+-----------+----------------------------+
> | id | 
> password                                                                      
>  
> | last_login | is_superuser | username | first_name | last_name | 
> email                    | is_staff | is_active | 
> date_joined                |
>
> +----+--------------------------------------------------------------------------------+------------+--------------+----------+------------+-----------+--------------------------+----------+-----------+----------------------------+
> |  1 | 
> pbkdf2_sha256$180000$8waw72qXD5IL$nDgySLTPAt3uLNnUMhzpPVodbkGYtYJJsmBilA7X6g8=
>  
> | NULL       |            1 | mohsen   |            |           | 
> moh...@pahlevanzadeh.net <javascript:> |        1 |         1 | 
> 2020-07-03 05:57:34.351606 |
> |  2 | 
> pbkdf2_sha256$180000$NNVfAk9Z98Uz$5m6HPp42ytlZeyLiy8jsYgUKjREu8WbDeLhAb7dFi0M=
>  
> | NULL       |            1 | ali      |            |           | 
> a...@example.com <javascript:>            |        1 |         1 | 
> 2020-07-03 05:58:09.429542 |
>
> +----+--------------------------------------------------------------------------------+------------+--------------+----------+------------+-----------+--------------------------+----------+-----------+----------------------------+
> 2 rows in set (0.000 sec)
>
> #########################################################################
>
> And When I print(User.objects.all()) , I get the following result:
> #########################################
> <QuerySet [<User: mohsen>, <User: ali>]>
> [03/Jul/2020 05:58:33] "GET /sql/ HTTP/1.1" 200 4
> ##########################################
>
> Why I can't see all of my fields?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/a4372a4b-d02d-4859-b34c-8e3fcd31b24eo%40googlegroups.com.

Reply via email to