def profilki(request):
profilki = profile.objects.all()
context = {'profilki':profilki }
return render(request,'base/profilki.html',context)
def profilepage(request,pk): user = Trainingvalue.objects.get(id=pk) trainingplan = Trainingvalue.objects.all() profilepage= profile.objects.get(id=pk) user_training= Trainingvalue.objects.filter(user=profilepage.user) context
={‘user_training’:user_training,‘user’:user,‘profilepage’:profilepage, ‘trainingplan’:trainingplan,}
return render(request, 'base/profilepage.html' , context) url : path (‘profilepage/str:pk/’,views.profilepage, name=“profilepage”)
profilepage in context profile page has an attribute id profilepage.id entity does not provide value - yet i can access it through the borwser…
so technically this should work in html template:
profile
i get error:
Reverse for 'profilepage' with arguments '('',)' not found. 1 pattern(s) tried: ['profilepage/(?P<pk>[^/] )/\\Z']
CodePudding user response:
profilepage/pk/ needs an id to be sent to the backend. Its a detail call. But you are sending "" empty.
CodePudding user response:
profile
I have this, still does not work , yet I can acces using the same website using http://127.0.0.1:8000/profilepage/1 so id is there