Guest User

Untitled

a guest
Jul 23rd, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. class Exam(models.Model):
  2.     subject = models.ForeignKey(Subject)
  3.     date = models.DateTimeField(auto_now=False, auto_now_add=False)
  4.     add_date = models.DateTimeField(auto_now_add=True, auto_now=False)
  5.  
  6.     @property
  7.     def how_many_days(self) -> int:
  8.         return (self.date - timezone.now()).days
  9.  
  10.     @property
  11.     def is_past(self) -> bool:
  12.         return self.how_many_days < 0
Advertisement
Add Comment
Please, Sign In to add comment