Unable to view my categories under category view

39 views
Skip to first unread message

Ifeanyi Okoli

unread,
May 25, 2023, 4:44:36 PM5/25/23
to Django users
Hello,

Please I am building a simple blog, and the video I am referencing used a function view for the category view but is not working for me. I am unable to see the list of posts based on categories.

Every other thing works except the category view. It shows me   "Sorry, this category does not exist yet..."  which indicates that it is not reading or seeing the list of posts.

I have tried using class view but is also not working.

Please see screenshots of my code in the attached file.

Kindly assist.

Thanks.

Ifeanyi
urls.JPG
views.JPG
categories.JPG

Chetan Ganji

unread,
May 26, 2023, 8:16:04 AM5/26/23
to django...@googlegroups.com
Variable name in the context of CategoryListView is cat_menu_list. 
I did not see that variable name in the template. In the template you are iterating over a variable that doesnt exist in the context. 

Iterate over cat_menu_list in the template and it should work fine!


Regards,
Chetan Ganji
+91-900-483-4183


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/47b10a5c-6252-4ee7-9b18-3b9ecd2bfa75n%40googlegroups.com.

Ryan Nowakowski

unread,
May 27, 2023, 4:57:31 PM5/27/23
to Ifeanyi Okoli, Django users
Does the url in your browser url bar contain a category id like this:

http://example.com/category/13/

?

Ifeanyi Okoli

unread,
May 28, 2023, 10:30:44 PM5/28/23
to django...@googlegroups.com
Thank you so much, this was very helpful.

You received this message because you are subscribed to a topic in the Google Groups "Django users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/django-users/VsHvOgeiOjs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAMKMUjvGUtmr6HK0BMehdKxf2e6ixwDXngfSzMXCGRaz3-%3D4ig%40mail.gmail.com.
Reply all
Reply to author
Forward
0 new messages