In function get_context_data
-
context['year_list'] = [2010, 2011, 2012]
context['current_year'] = self.request.path.split("/")[2]
The year_list
values are integer
whereas current_year
value is string
. That's why they are not matching in template. Do this in your code -
context['current_year'] = int(self.request.path.split("/")[2])
This should work