GenericView: Attributeerror ‘list’ object has no attribute ‘filter’ // 1-second guide 😮💢

So you are casually overriding get_queryset() in a, say, ListView, like this:

def get_queryset(self):
    entries = [x for x in Entry.objects.all() if x.publications]
    return entries

Because you need to sort the Entry table by a reverse M2M relation publications and then BAM!:

Attribute error 'list' object has no attribute 'filter'

Without a trace of the line you made a mistake in…

Read More »