firstly i would like to thank you for trying to help me,
secondly unfortunately you didn’t get my point bro
i was trying to say that the problem in django itself because it ignoring all my redirect patterns in views.py file not only the sign up or login function but all the functions in my views
I will tell you why this happens
django and i don’t know why doing that, search by default on this pattern only
accounts/profile
thirdly
you didn’t notice that my login view was having to redirects
the first one is when the user is already authenticated, so i need to take the user id from the request.user.id
the second one is when the user is not authenticated and here i have to use only user.id
so i used to try the first one as i was already authenticated and also the second one when i logged out
So whenever i try any pattern in my views he never look for it as you may didn’t noticed
i have tried all kinds of patterns and they should work all
i knew that i was wrong in using reverse in redirect but the problem bro was never relate to the
redirect or urls patterns at all cause i already tried these patterns but never work
user = get_user_model().objects.get(id=request.user.id) # or username=request.user.username
profile = Profile.objects.get(user=user)
return redirect(profile)
return redirect('http://localhost:8000/accounts/id/')
return redirect('accounts:profile', id=user.id)
return redirect('/accounts/id', id=user.id)
return redirect('accounts:profile')
id = User.objects.get(username=request.user.username).id
return redirect('accounts:profile', id=id) # return redirect('/')
return redirect('accounts:profile', request.user.id)
return redirect('/accounts/id', request.user.id)
return reverse('accounts:profile', args={'id': user.id})
return reverse('/accounts/id', permanent=False, args={'id': request.user.id})
return redirect('accounts:profile', args=[user.id])
return redirect('accounts:profile', kwargs=[user.id])
They never work at all as i told you cause django ignoring all kinds of patterns that i have tried although they are correct all and should work fine and that
because django ignore my redirect pattern at all
anyway
when i added this line in settings
LOGIN_REDIRECT_URL= accounts/id
django look for the same pattern
accounts/id
and ignore also all my patterns in views
i have tried also to change my details view function to take the username instead of the id
and i got another strange error that
he fount the pattern but telling me that
no User match found
even when he got the user.username that already exist in session and in the request
So the problem was that details or profile function should never take any id or user name and just
got the profile using this next line when i be already authenticated
profile = User.objects.get(user=request.user)
and when i be not authenticated
profile = User.objects.get(user=user)
and then the simplest pattern
'accounts:profile'
did works already and no need for any other pattern
so what do you think about that
django only recognise this pattern
accounts/profile
after adding this patter in my urls i could get my profile page
so i read the docs already but there was no solution in it because i have tried all kind of versions of redirect and changed everything to notice this bug as i think in django itself
i don’t know why it doing so and ignore all views pattern except when it be like that
path(profile/, detils, name=profile)
so i think this bug should be taken care of someone among who creates or develop the framework, but if you have the reason please tell me why
the other problem we never take about it also but it’s already bee solved by changing the signup view
Anyway thanks for everything bro and for trying to help