onclick='location.href="{% url 'category' category.category %}";'
你确定类别模型中的内部字段叫做类别吗!?
如果不行的话我建议用JS构造URL