On Wed, 2008-12-17 at 08:25 -0600, Milan Andric wrote:
> On Wed, Dec 17, 2008 at 4:00 AM, Thomas Guettler <h...@tbz-pariv.de> wrote:
> >
> > Hi,
> >
> > The method user.get_profile() fails, if the user has no profile. During
> > my custom login I
> > check if the user has a profile and create it if needed.
> >
> > But sometimes this fails: A new user gets created, but before his first
> > login someone else
> > tries to access the not yet created profile.
> >
> > Since all fields of my profile model have default values, it could be
> > created it on the fly.
> >
> > Since I don't want to run a modified django, I will use my own
> > get_profile method.
> >
> > Does some know this problem? How do you solve this?
> >
> >  Thomas
> >
> 
> How about setting up a signal on user creation that also creates a profile?

This would be the "standard" solution. I thought James Bennett's
django-profiles app did this, but apparently I'm mistaken (it would be
slightly duplicated work if it did, in any case).

Register a handle for post_save on the User model, and, in the handler,
if created=True, create the associated user profile.

Regards,
Malcolm



--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to