veryacademy / django-ecommerce-project

The Django-Ecommerce is an open-source project initiative and tutorial series built with Python and the Django Framework.
MIT License
399 stars 278 forks source link

Part-05: category__in filters name=category_slug throws exception when slug is different from name #7

Open BjornHeller opened 2 years ago

BjornHeller commented 2 years ago

in store>view.py line 13

category__in=Category.objects.get(name=category_slug).get_descendants(include_self=True)

should most likely be

category__in=Category.objects.get(name=category).get_descendants(include_self=True)

if the slug and the category name does not match, it throws and exception in the original code. The category name is already retrieved in line 13.