CoreyMSchafer/code_snippets

RelatedObjectDoesNotExist at /profile/ User has no profile.

Opened this issue · 10 comments

RelatedObjectDoesNotExist at /profile/ User has no profile.

i started having the same issue, probably there is some problem in signals.py, can't rectify the exact problem but it reappearing continuously...

i started having the same issue, probably there is some problem in signals.py, can't rectify the exact problem but it reappearing continuously...

This line is to be added in views.py.(import Profile from models.py first)

def profile(request):
profile,created = Profile.objects.get_or_create(user=request.user)

Now it works fine

how to resolve
user has no profile

i started having the same issue, probably there is some problem in signals.py, can't rectify the exact problem but it reappearing continuously...

This line is to be added in views.py.(import Profile from models.py first)

def profile(request):
profile,created = Profile.objects.get_or_create(user=request.user)

Now it works fine

Thanks, it also worked for me, and I don't know how I could handle this if it wasn't you

i started having the same issue, probably there is some problem in signals.py, can't rectify the exact problem but it reappearing continuously...

This line is to be added in views.py.(import Profile from models.py first)
def profile(request):
profile,created = Profile.objects.get_or_create(user=request.user)
Now it works fine

Thanks, it also worked for me, and I don't know how I could handle this if it wasn't you

Hey buddy! I couldn't fix this issue. May I know what did you do to fix this? I tried the steps mentioned by @HariniRao19 but not working.

i started having the same issue, probably there is some problem in signals.py, can't rectify the exact problem but it reappearing continuously...

This line is to be added in views.py.(import Profile from models.py first)
def profile(request):
profile,created = Profile.objects.get_or_create(user=request.user)
Now it works fine

Thanks, it also worked for me, and I don't know how I could handle this if it wasn't you

Hey buddy! I couldn't fix this issue. May I know what did you do to fix this? I tried the steps mentioned by @HariniRao19 but not working.

@Pravinrams
The cause of the issue is that the user that you are trying to log in with, has profile (avatar image), not even the default.
What I did was create a new super user to delete the confilctive account and that solved the issue.
I was not able to try the solution provided by @HariniRao19, but that is a better way to solve the issue.

i started having the same issue, probably there is some problem in signals.py, can't rectify the exact problem but it reappearing continuously...

This line is to be added in views.py.(import Profile from models.py first)

def profile(request):
profile,created = Profile.objects.get_or_create(user=request.user)

Now it works fine

But how did it worked in video? and what it means?

i started having the same issue, probably there is some problem in signals.py, can't rectify the exact problem but it reappearing continuously...

This line is to be added in views.py.(import Profile from models.py first)
def profile(request):
profile,created = Profile.objects.get_or_create(user=request.user)
Now it works fine

Thanks, it also worked for me, and I don't know how I could handle this if it wasn't you

Hey buddy! I couldn't fix this issue. May I know what did you do to fix this? I tried the steps mentioned by @HariniRao19 but not working.

Hi! So I had the same issue, turns out the second function name is save_profile