You can create your own method for your model that will appreciate this for you:
class User(models.Model): active_status = models.BooleanField(default=1) def is_active(self): return bool(self.active_status)
Then, any tests you run against this field can simply reference this method:
>>> u.is_active() True
You can even do this in the property:
class User(models.Model): active_status = models.BooleanField(default=1) @property def is_active(self): return bool(self.active_status)
so that class users do not even know that they are implemented as a method:
>>> u.is_active True
source share