When I create two topics with the same name, the error: MultipleObjectsReturned
class ForumView(ListView):
paginate_by = 5
template_name = 'forum/forum.html'
def get_queryset(self):
queryset = Thread.objects.filter()
order = self.request.GET.get('order','')
if order == 'views':
queryset = queryset.order_by('-views')
elif order == 'answers':
queryset = queryset.order_by('-answers')
return queryset
How to change the query to not give error with thread of the same name?