комит
This commit is contained in:
@@ -262,14 +262,18 @@ class Subscription(models.Model):
|
||||
|
||||
def is_expired(self):
|
||||
"""Проверка истечения подписки"""
|
||||
if not self.expires_at:
|
||||
return False
|
||||
return timezone.now() > self.expires_at
|
||||
|
||||
def days_left(self):
|
||||
"""Количество дней до окончания подписки"""
|
||||
if not self.expires_at:
|
||||
return 0
|
||||
if self.is_expired():
|
||||
return 0
|
||||
delta = self.expires_at - timezone.now()
|
||||
return delta.days
|
||||
return max(delta.days, 0)
|
||||
|
||||
@staticmethod
|
||||
def create_trial(client):
|
||||
|
||||
Reference in New Issue
Block a user