Following is my code in URL.py, views.py and HTML page. However, it returns me the error: TypeError: cannot unpack non-iterable int object.
urlpatterns = [
path('', views.blogs_home, name='blogs'),
path('<int:id>', views.single_blog, name='detailed_view'),
]
I am trying to capture the id of posts blogs in the list view to get the blog object from the database with id query. Following is my view code.
def single_blog(request,id):
blog_single = Blogs.objects.get(id)
context = {'blog_single': blog_single}
template = 'blog_home.html'
return render(request, template, context)
However, as I mentioned, it returns the above error.
Could someone explain what I am doing wrong