def viewed(self):
type(self).objects.filter(id=self.id).update(views=F('views') + 1)
File /usr/lib/python3.5/....
должна наталкивать на эту мысль.brands = Brand.objects.filter(
products__material__in=materials,
country__in=countries
).distinct()