1👍
✅
If I’ve understood correctly, you don’t need the second view and url pattern. You could check for the existence of the ‘tag’ parameter and create the queryset according to that.
def get_queryset(self):
if self.request.GET.get('tag'):
self.tag_name = self.request.GET['tag']
return self.send_results(self.tag_name)
else:
self.tag_name = "All"
return Fact.objects.all()
For a hard coded link in the template’s HTML you could use:
<a href="{% url 'your_view' %}?tag=AAA">Tag AAA</a>
Source:stackexchange.com