Last active
July 19, 2018 15:12
-
-
Save i/771cbdc2fada36b3829d4f430934c53c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SoftDeleteModel(BaseModel): | |
class meta: | |
abstract = True | |
is_deleted = models.DateTimeField(null=False, default=False) | |
def delete(self): | |
self.is_deleted = True | |
self.save() | |
def restore(self): | |
self.is_deleted = False | |
self.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment