My function in views.py is: def detail(request,pk): singlepost=get_object_or_404(iblog,pk=pk) return render(request,'blog/blogpost.html',{'singlepost':singlepost})
My databse has several items but it return 404 error why ? Also i use path('/',views.detail,name='detail')
for mapping url and calling detail function in views.py i test other parts of my project without get_object_or_404 function and every thing go right My problem is in primary key How can i resolve this problem? Thanks
Aucun commentaire:
Enregistrer un commentaire