1👍
Yes, the problem is that Django renders the URLs before the JQuery code is interpreted. I would use a GET parameter instead :
$(document).ready(function(){
$('thead th').each(function(){
var html = $(this).html();
var url = "{% url "cat_view" %}?cat=" + html;
$(this).html('<a href="' + url + '">'+ html +'</a>');
});
});
Source:stackexchange.com