James said it all. I'll just add that you really need to brush up on your python. Django is pure python. I've all been there before. On 6 Jan 2015 21:10, "Henry Versemann" <[email protected]> wrote:
> I tried what you suggested and printed from the view what the type command > returned and it looks like this: > > type(userobj)=(<class 'django.contrib.auth.models.User'>) > > so that part of it does seem to be working. So why can't I see the other > values within the object then displayed in normal object notation instead > of just seeing this: > > userobj=(hvadmin) > > when I print out a string representation of the User object? I had > expected to see a lot of different fields like "id", > "username", "first_name", "last_name", "email", "password", "groups", > "user_permissions", "is_staff", "is_active", "is_superuser", "last_login", > and "date_joined" > > which are just about all of the columns defined for the User model > according to the documentation. > So how do I get to that data then if I can't see it this way? > Thanks for the help. > > On Tuesday, January 6, 2015 1:18:57 PM UTC-6, Tundebabzy wrote: > >> userobj = User.objects.get(username=myuser) >> >> Will get you a User object or throw an error if it can't find anything. >> The string representation of the User object is the string contained its >> username field. >> >> Try this to confirm: >> type(userobj) >> On 6 Jan 2015 18:48, "Henry Versemann" <[email protected]> wrote: >> >>> I currently using Python 2.7.7 and Django 1.7 as I build a new >>> application. >>> I need to retrieve an entire User object from the authentication User >>> Model, but when I do the following: >>> >>> userobj = User.objects.get(username=myuser) >>> >>> all I'm getting returned is just the same username value (contained in >>> myuser) that I'm trying to use, to get the complete associated User object. >>> So my question is what am I doing wrong? >>> Can't I use a regular query on the User model (that I get from this >>> import: "from django.contrib.auth.models import User" ) the same way that I >>> would be able to use on one of my application's models? >>> This is very frustrating and while I'm comfortable with using Django >>> apparently I still have a lot to learn about it. >>> Thanks for the help. >>> >>> -- >>> 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 [email protected]. >>> To post to this group, send email to [email protected]. >>> Visit this group at http://groups.google.com/group/django-users. >>> To view this discussion on the web visit https://groups.google.com/d/ >>> msgid/django-users/b9f1b941-d01b-402a-94e9-33b2dbd13dbe% >>> 40googlegroups.com >>> <https://groups.google.com/d/msgid/django-users/b9f1b941-d01b-402a-94e9-33b2dbd13dbe%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at http://groups.google.com/group/django-users. > To view this discussion on the web visit > https://groups.google.com/d/msgid/django-users/18705df9-e1da-4c85-9b21-9e13949b6d20%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/18705df9-e1da-4c85-9b21-9e13949b6d20%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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 [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BWjgXOLku6HtvQzueQV6UiMo0za4nb6gnjWQw_Vha3GTXaM0w%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.

