Skip to content
Advertisement

RelatedObjectDoesNotExist. User has no profile

I’ve read some other answers for this (almost) question but they didn’t help. I have the following 2 files mixed for user and profile apps(?). In other answers they said this happens if you don’t use >objects.get_or_create or not making signals.py file you’ll get this error but I’ve gone through both of those ways and no results. This is the traceback I get:

JavaScript

forms.py:

JavaScript

signal.py:

JavaScript

models.py for profile model:

JavaScript

and this is the views.py file:

JavaScript

Thanks for reading this :).

P.S. As I see in admin page, no profiles are made after registration (neither from site nor admin page).

Advertisement

Answer

Good to see someone who’s practicing Django with Corey’s tutorial! It took me few days to catch what went wrong. Here’s how I did it.

Your views.py looks like this:

JavaScript

Add one in views.py so that it looks like below

JavaScript

If you happen to face same issue somehow, create a new account and go to profile page and see if it throws any error.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement