[Fixed]-Global name not defined when filtering on model

1👍

The problem is in this method:

def get_brands(self):
        return  Product.objects.filter(category__in=self.get_descendants(include_self=True) , brand=product__brand) #This line

It should be:

return  Product.objects.filter(category__in=self.get_descendants(include_self=True) , brand= 'something') # instead of product__brand
👤ruddra

Leave a comment