Re: User.objects.all() returns only one field
User.objects.all() will return a queryset you can put it in a loop such as users = User.objects.all() for user in users: user.first_name And also there are other ways to get dict instead of queryset object but its up to you. Sent from my iPhone > On 7 May 2020, at 2:46 PM, Mohsen Pahlevanzadeh > wrote: > > User.objects.all() only returns one field, I need to others fields > such as first_name or last_name. > > How can I access others field? > > -- > 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/CAJFFGZ%2BG84ORqhqgCDDN8jTQdNSpt_XUZMLRaO9LXb%3D1fc158Q%40mail.gmail.com. -- 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/ACB66807-3F15-460E-9B0E-AB070F9189D2%40gmail.com.
Re: User.objects.all() returns only one field
On Thursday, 7 May 2020 12:47:21 UTC+1, Mohsen Pahlevanzadeh wrote: > > User.objects.all() only returns one field, I need to others fields > such as first_name or last_name. > > How can I access others field? > No it doesn't. It returns a queryset of objects, each of which has all the fields. When you print the entire queryset, it calls the `__repr__` method of each element. -- DR. -- 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/ecc703ce-fc40-4533-a7ea-564ba7c870f7%40googlegroups.com.
User.objects.all() returns only one field
User.objects.all() only returns one field, I need to others fields such as first_name or last_name. How can I access others field? -- 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/CAJFFGZ%2BG84ORqhqgCDDN8jTQdNSpt_XUZMLRaO9LXb%3D1fc158Q%40mail.gmail.com.