diff --git a/abonapp/locale/ru/LC_MESSAGES/django.po b/abonapp/locale/ru/LC_MESSAGES/django.po index 0195353..af39eea 100644 --- a/abonapp/locale/ru/LC_MESSAGES/django.po +++ b/abonapp/locale/ru/LC_MESSAGES/django.po @@ -515,10 +515,6 @@ msgstr "Входящая скорость" msgid "Output speed" msgstr "Исходящая скорость" -#: abonapp/templates/abonapp/services.html:15 -msgid "Edit" -msgstr "Ред." - #: abonapp/templates/abonapp/services.html:52 msgid "Priority up" msgstr "Повысить приоритет" @@ -745,3 +741,9 @@ msgstr "Устройство успешно прикреплено" msgid "Device has successfully unattached" msgstr "Устройство успешно откреплено" + +msgid "Works until" +msgstr "Действует до" + +msgid "Do" +msgstr "Действия" diff --git a/abonapp/models.py b/abonapp/models.py index 1b1250f..16bdd3e 100644 --- a/abonapp/models.py +++ b/abonapp/models.py @@ -112,7 +112,7 @@ class AbonTariff(models.Model): return round(amount, 2) # Активируем тариф - def activate(self, current_user): + def activate(self, current_user, deadline=None): calc_obj = self.tariff.get_calc_type()(self) amnt = self.tariff.amount # если не хватает денег @@ -121,7 +121,10 @@ class AbonTariff(models.Model): # считаем дату активации услуги self.time_start = timezone.now() # считаем дату завершения услуги - self.deadline = calc_obj.calc_deadline() + if deadline is None: + self.deadline = calc_obj.calc_deadline() + else: + self.deadline = deadline # снимаем деньги за услугу self.abon.make_pay(current_user, amnt) self.save() @@ -225,7 +228,6 @@ class Abon(UserProfile): return ats[0].tariff else: self._act_tar_cache = None - return class Meta: db_table = 'abonent' @@ -250,7 +252,7 @@ class Abon(UserProfile): self.ballance += amount # покупаем тариф - def pick_tariff(self, tariff, author, comment=None): + def pick_tariff(self, tariff, author, comment=None, deadline=None): assert isinstance(tariff, Tariff) # выбераем связь ТарифАбонент с самым низким приоритетом @@ -267,7 +269,7 @@ class Abon(UserProfile): # Если это первая услуга в списке (фильтр по приоритету ничего не вернул) if not abtrf: # значит пробуем её активировать - new_abtar.activate(author) + new_abtar.activate(author, deadline) else: new_abtar.save() diff --git a/abonapp/templates/abonapp/buy_tariff.html b/abonapp/templates/abonapp/buy_tariff.html index 8e84d97..f6782e9 100644 --- a/abonapp/templates/abonapp/buy_tariff.html +++ b/abonapp/templates/abonapp/buy_tariff.html @@ -5,8 +5,8 @@
@@ -15,23 +15,43 @@