Open alexakarpov opened 2 years ago
I think the error occurred at some refactoring effort after the Part 01 - there, the context in category_list view has the variable that seems to have gone missing:
category = get_object_or_404(Category, slug=category_slug)
And at the Part 02's Final stage, the problem is already present
Note: when on the page where a category is selected at the dropdown element (and it is also a part of a route), the view, category_list in this case, does add 'category' variable to the context, and there's no error. But the product_all has no such variable on the context, yet as it uses the same base.html, the problem duly manifests itself. A good debugging exercise =)
I don't know, exactly, why the site keeps working, but once I've enabled debug logging server-side, there came in a flood of messages pointing to the same problem on lines 46 and 125:
, where 'category' variable does not exist. The code above is taken from Chapter 10.