Last active
June 3, 2020 04:53
-
-
Save cristianjs19/500af529d5b76c9824a3bf6c65cc83fd to your computer and use it in GitHub Desktop.
This file contains hidden or 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 Foo(models.Model): | |
status = models.CharField() | |
expiring_date = models.DateField() | |
def is_active(self): | |
today = datetime.date.today() | |
if today > self.expiring_date: | |
self.status = "expired" | |
self.save() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment