get_profile() uses default profile model manager. So if you profile
model is Profile - exception is Profile.DoesNotExist that is subclass
of ObjectDoesNotExist

On 13 янв, 02:45, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> I had the settings.py configured with the wrong Model name.
> useraccount instead of userprofile.
>
> Whoops. Thanks!
>
> Though the documentation might be wrong, in that DoesNotExist doesn't
> seem to be a real exception. ObejctDoesNotExist, as defined in django/
> core/exceptions.py, is the correct exception when a profile doesn't
> exist if user.get_profile() is called.
>
> Ivan
>
> On Jan 12, 3:24 pm, Alex Koshelev <[EMAIL PROTECTED]> wrote:
>
> > Do you create a profile model and set right value in settings.py 
> > file?http://www.djangoproject.com/documentation/authentication/#storing-ad...
>
> > And User.get_pofile() does not require logged in user. Note that
> > profile instance per user you must create manually.
>
> > On 13 янв, 01:32, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> > wrote:
>
> > > I'm trying to catch any exceptions from user.get_profile() during
> > > account creation in order to create the profile
>
> > > I create the user, authenticate them, log them in, and then try to
> > > get_profile. To start out, the user name is the email and I'm setting
> > > the password to a random string
>
> > > newUser = User.objects.create_user(email, email, randomString )
> > > user = auth.authenticate(username=email, password=randomString)
> > > auth.login(request, user)
> > > userProfile = user.get_profile()
>
> > > This causes an error:
> > > AttributeError("'NoneType' object has no attribute
> > > '_default_manager'",),
>
> > > I expected an ObjectDoesNotExist exception. It looks like the user
> > > object doesn't exist, but I explicitly test for "user is None"
>
> > > What is this about?
>
> > > Thanks,
> > > Ivan
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to