以下は、 https://github.com/jeffbowen/django-logicaldelete/blob/master/logicaldelete/models.pyのコードです。
コードで何をするのか理解しようとしてactive.boolean = True
います。
class Model(models.Model):
"""
This base model provides date fields and functionality to enable logical
delete functionality in derived models.
"""
date_created = models.DateTimeField(default=timezone.now)
date_modified = models.DateTimeField(default=timezone.now)
date_removed = models.DateTimeField(null=True, blank=True)
objects = managers.LogicalDeletedManager()
def active(self):
return self.date_removed == None
active.boolean = True # <------------------- HERE
def delete(self):
self.date_removed = timezone.now
self.save()
class Meta:
abstract = True