That fixed it! I thought it automatically created and attached one
which is why i was so confused.

On Sep 20, 8:14 pm, Paddy Joy <[EMAIL PROTECTED]> wrote:
> The error message is telling you that the user has no profile
> (Specifically there is no record in the table schedule.profile related
> to the user).
>
> Your app needs to take care of creating the user profile, even if it
> going to be empty. What I have done in my case is I force the user to
> create a profile when they first log on by checking if the profile
> exists.
>
>         # Check if logged in user has profile, if not redirect to
> create profile
>         try:
>                 profile = request.user.get_profile()
>         except:
>                 return HttpResponseRedirect("/createprofile/")
>
> Paddy
>
> On Sep 21, 8:48 am, mclovin <[EMAIL PROTECTED]> wrote:
>
> > I have spent about 2 hours on this so far, but havent been able to get
> > it right, my model is:
>
> > (located in schedule/models.py, stripped down to just the profile)
>
> > from django.contrib.auth.models import User
> > class profile(models.Model):
> >     user = models.ForeignKey(User, unique=True)
> >     aim = models.CharField(max_length=100, blank=True)
> >     website = models.CharField(max_length=100, blank=True)
>
> > and i have this as my setting:
> > AUTH_PROFILE_MODULE = 'schedule.profile'
>
> > I did a syncdb and it showed the profile successfully being added...
>
> > then i did in "python manage.py shell":
> > from django.contrib.auth.models import User
> > u = User.objects.get(pk=1)
> > print u.get_profile().aim
>
> > but I get this error:
> > Traceback (most recent call last):
> >   File "<console>", line 1, in <module>
> >   File "/usr/lib/python2.5/site-packages/django/contrib/auth/
> > models.py", line 293, in get_profile
> >     self._profile_cache =
> > model._default_manager.get(user__id__exact=self.id)
> >   File "/usr/lib/python2.5/site-packages/django/db/models/manager.py",
> > line 93, in get
> >     return self.get_query_set().get(*args, **kwargs)
> >   File "/usr/lib/python2.5/site-packages/django/db/models/query.py",
> > line 303, in get
> >     % self.model._meta.object_name)
> > DoesNotExist: profile matching query does not exist.
>
> > anyone have any idea what is wrong?
--~--~---------~--~----~------------~-------~--~----~
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