1
I would solve this problem with Abstract Model Inheritance.
This will allow you to write logic for one class and set of fields and it will apply to all child classes.
class IsActive(models.Model):
class Meta:
abstract = True
is_active = models.BooleanField(default=False)
def toggle_active(self):
self.is_active = !self.is_active
class Child(IsActive):
# This object now has `is_active` and `toggle_active` fields.
Source:stackexchange.com