Question

I'm using django-registration and django-profiles and after having confirm the registration, I meet a 404 when I try to access to the page http://example.com/profiles/fox/ -

I saw with the debug_toolbar all the queries that have been made and saw one on the table I defined in the settings AUTH_PROFILE_MODULE = 'tglr.UserProfile' - the query on this model returns ... nothing.

It looks like that the registration confirmation did not do its job.

What do i miss ?

thank you for your help

regards

edit: if I add the missing record in the UserProfile table all goes well - this really seems to confirm the behavior I met.

Was it helpful?

Solution

This sounds like a UserProfile record wasn't created when you registered the user. The page on user profiles in the Django manual details how a post_save signal can automatically insert a UserProfile record when a user is created. Specifically, try adding this somewhere near you user model:

# FROM THE ABOVE LINK: 
# in models.py
from django.db.models.signals import post_save

def create_user_profile(sender, instance, created, **kwargs):
    if created:
        UserProfile.objects.create(user=instance)

post_save.connect(create_user_profile, sender=User)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top