diff --git a/accounts_app/forms.py b/accounts_app/forms.py index 84ffb6b..986641c 100644 --- a/accounts_app/forms.py +++ b/accounts_app/forms.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- from guardian.forms import UserObjectPermissionsForm from guardian.shortcuts import assign_perm, remove_perm from django import forms diff --git a/devapp/dev_types.py b/devapp/dev_types.py index 57d264e..a1c88fe 100644 --- a/devapp/dev_types.py +++ b/devapp/dev_types.py @@ -268,7 +268,7 @@ class OnuDevice(DevBase, SNMPBaseWorker): distance = self.get_item('.1.3.6.1.4.1.3320.101.10.1.1.27.%d' % num) mac = self.get_item('.1.3.6.1.4.1.3320.101.10.1.1.3.%d' % num) if mac is not None: - mac = ':'.join('%x' % ord(i) for i in mac) + mac = ':'.join('%x' % i for i in mac) # uptime = self.get_item('.1.3.6.1.2.1.2.2.1.9.%d' % num) if status is not None and status.isdigit(): return { @@ -276,7 +276,7 @@ class OnuDevice(DevBase, SNMPBaseWorker): 'signal': signal / 10 if signal else '—', 'name': self.get_item('.1.3.6.1.2.1.2.2.1.2.%d' % num), 'mac': mac, - 'distance': int(distance) / 10 if distance.isdigit() else 0 + 'distance': distance / 10 if distance else 0 } except EasySNMPTimeoutError as e: return {'err': "%s: %s" % (_('ONU not connected'), e)} diff --git a/devapp/templates/devapp/custom_dev_page/onu.html b/devapp/templates/devapp/custom_dev_page/onu.html index fd6258a..ac2c2e1 100644 --- a/devapp/templates/devapp/custom_dev_page/onu.html +++ b/devapp/templates/devapp/custom_dev_page/onu.html @@ -59,9 +59,9 @@ {% else %}
- {% if onu_details.status == '3' %} + {% if onu_details.status == 3 %} - {% elif onu_details.status == '2' %} + {% elif onu_details.status == 2 %} {% else %} diff --git a/devapp/templates/devapp/custom_dev_page/onu_for_zte.html b/devapp/templates/devapp/custom_dev_page/onu_for_zte.html index 8575b7b..a8f89a1 100644 --- a/devapp/templates/devapp/custom_dev_page/onu_for_zte.html +++ b/devapp/templates/devapp/custom_dev_page/onu_for_zte.html @@ -60,9 +60,9 @@ {% else %}
- {% if onu_details.status == '1' %} + {% if onu_details.status == 1 %} - {% elif onu_details.status == '2' %} + {% elif onu_details.status == 2 %} {% else %} diff --git a/devapp/views.py b/devapp/views.py index 3cc2014..ac18cc8 100644 --- a/devapp/views.py +++ b/devapp/views.py @@ -681,7 +681,7 @@ def fix_onu(request): }) for srcmac, snmpnum in ports: # convert bytes mac address to str presentation mac address - real_mac = ':'.join('%x' % ord(i) for i in srcmac) + real_mac = ':'.join('%x' % i for i in srcmac) if mac == real_mac: onu.snmp_extra = str(snmpnum) onu.save(update_fields=('snmp_extra',)) diff --git a/djing/settings.py b/djing/settings.py index afce2ad..312f2f2 100644 --- a/djing/settings.py +++ b/djing/settings.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -* import os try: diff --git a/requirements.txt b/requirements.txt index 8f1d638..bb79584 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,31 +1,30 @@ -wheel -urllib3 -Django>=2 -Pillow +urllib3==1.25.10 +Django==2.2 +Pillow==7.2.0 # for mac address field -netaddr +netaddr==0.8.0 # for testing required xmltodict #xmltodict -dicttoxml +dicttoxml==1.7.4 # db client for Mariadb mysqlclient --e git://github.com/nerosketch/easysnmp.git#egg=easysnmp -pid -django-guardian -pinax-theme-bootstrap -django-bootstrap3 +git+git://github.com/nerosketch/easysnmp.git#egg=easysnmp +pid==3.0.4 +django-guardian==2.3.0 +pinax-theme-bootstrap==8.0.1 +django-bootstrap3==14.1.0 # django-jsonfield -e git://github.com/dmkoch/django-jsonfield.git#egg=django-jsonfield -requests -webdavclient -transliterate -django-encrypted-model-fields +requests==2.24.0 +webdavclient==1.0.8 +transliterate==1.10.2 +django-encrypted-model-fields==0.5.8 # django-xmlview for pay system allpay -e git://github.com/nerosketch/django-xmlview.git#egg=django-xmlview @@ -43,7 +42,7 @@ django-encrypted-model-fields -e git://github.com/pexpect/pexpect.git#egg=pexpect Celery -redis +redis==3.5.3 celery[redis] docxtpl diff --git a/tariff_app/custom_tariffs.py b/tariff_app/custom_tariffs.py index fbef017..c754cf3 100644 --- a/tariff_app/custom_tariffs.py +++ b/tariff_app/custom_tariffs.py @@ -1,12 +1,11 @@ -# -*- coding: utf-8 -*- -from datetime import timedelta, datetime +from datetime import timedelta, datetime, date + +from calendar import monthrange +from random import uniform from django.utils import timezone from django.utils.translation import gettext as _ from .base_intr import TariffBase, PeriodicPayCalcBase -from calendar import monthrange - -from random import uniform class TariffDefault(TariffBase): @@ -97,8 +96,10 @@ class PeriodicPayCalcDefault(PeriodicPayCalcBase): return model_object.amount def get_next_time_to_pay(self, model_object, last_time_payment) -> datetime: - # TODO: решить какой будет расёт периодических платежей - return datetime.now() + timedelta(days=30) + today = date.today() + nw = datetime(today.year, today.month, today.day) + days = monthrange(nw.year, nw.month)[1] + return nw + timedelta(days - nw.day + 1) class PeriodicPayCalcCustom(PeriodicPayCalcDefault):