Django - How to override filter on a model?

Viewed 7056

I'm curious if there's a best practice, or recommended way to accomplish this?

Say I have a model like this:

class Cat(models.Model):
    field1=models.CharField(...)
    field2=models.CharField(...)
    evil=models.BooleanField(...)

What I'm trying to accomplish is I want no views to ever be able to access Cat records where evil is True.

Do I really need to add .filter(evil=False) to every Cat.objects.filter call, or is there some way to do it once in the class and make the evil cats never show up anywhere?

1 Answers
Related