From befd67b0ecc14f7328c2b097cf27760760c3b3ae Mon Sep 17 00:00:00 2001 From: bashmak Date: Mon, 10 Apr 2017 12:38:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D1=84=D0=B8=D0=BB=D1=8C=D1=82=D1=80=20=D0=BF=D0=BE=20=D1=83?= =?UTF-8?q?=D0=BB=D0=B8=D1=86=D0=B0=D0=BC=20=D0=B2=20=D1=81=D0=BF=D0=B8?= =?UTF-8?q?=D1=81=D0=BE=D0=BA=20=D0=B0=D0=B1=D0=BE=D0=BD=D0=B5=D0=BD=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=B3=D1=80=D1=83=D0=BF=D0=BF=D1=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- abonapp/locale/ru/LC_MESSAGES/django.po | 3 + abonapp/templates/abonapp/peoples.html | 221 +++++++++++++----------- abonapp/views.py | 10 +- 3 files changed, 129 insertions(+), 105 deletions(-) diff --git a/abonapp/locale/ru/LC_MESSAGES/django.po b/abonapp/locale/ru/LC_MESSAGES/django.po index f5f7edd..02086fa 100644 --- a/abonapp/locale/ru/LC_MESSAGES/django.po +++ b/abonapp/locale/ru/LC_MESSAGES/django.po @@ -714,3 +714,6 @@ msgstr "Экземпляр option82 неожиданно исчез из баз msgid "SNMP error on device" msgstr "Ошибка в SNMP на устройстве" + +msgid "No streets found for that group" +msgstr "Не найдены улицы для группы" diff --git a/abonapp/templates/abonapp/peoples.html b/abonapp/templates/abonapp/peoples.html index 75aa8a0..651a6a5 100644 --- a/abonapp/templates/abonapp/peoples.html +++ b/abonapp/templates/abonapp/peoples.html @@ -12,112 +12,125 @@ {% include 'message_block.html' %}

{% trans 'The people in the selected group' %}

-
- - - - - - - - - - - - - - - - {% for human in peoples %} - {% if human.is_active %} +
+
+
+
- - {% trans 'Sub' %} - - {% if order_by == 'username' %}{% endif %} - - - {% trans 'Ip address' %} - - {% if order_by == 'ip_address' %}{% endif %} - - - {% trans 'fio' %} - - {% if order_by == 'fio' %}{% endif %} - - - {% trans 'Street' %} - - {% if order_by == 'street' %}{% endif %} - - - {% trans 'House' %}/{% trans 'Apartment' %} - - {% if order_by == 'house' %}{% endif %} - {% trans 'Telephone' %}{% trans 'Service' %} - - {% trans 'Ballance' %} - - {% if order_by == 'ballance' %}{% endif %} - #
+ - {% else %} - - {% endif %} - - - - - - - + + + + + + + + + + + + {% for human in peoples %} + {% if human.is_active %} + + {% else %} + {% endif %} - {% else %}——— - {% endif %} - - - - - {% empty %} - - - - {% endfor %} - - - - - - -
{{ human.username }}{{ human.ip_address|default:_('Not assigned') }}{{ human.fio }}{{ human.street|default:_('Not assigned') }}{{ human.house|default:_('Not assigned') }}{{ human.telephone }} - {% if human.active_tariff %} - {% if perms.tariff_app.change_tariff %} - {{ human.active_tariff.title }} - {% else %} - {{ human.active_tariff.title }} + + + {% trans 'Sub' %} + + {% if order_by == 'username' %}{% endif %} + + + {% trans 'Ip address' %} + + {% if order_by == 'ip_address' %}{% endif %} + + + {% trans 'fio' %} + + {% if order_by == 'fio' %}{% endif %} + + + {% trans 'Street' %} + + {% if order_by == 'street' %}{% endif %} + + + {% trans 'House' %}/{% trans 'Apartment' %} + + {% if order_by == 'house' %}{% endif %} + {% trans 'Telephone' %}{% trans 'Service' %} + + {% trans 'Ballance' %} + + {% if order_by == 'ballance' %}{% endif %} + #
{{ human.ballance }} - {% if perms.abonapp.delete_abon %} - - - - {% endif %} -
- {% trans 'Subscribers not found' %}. - {% if perms.abonapp.add_abon %} - {% trans 'Add abon' %} - {% endif %} -
- {% if perms.abonapp.add_abon %} - - {% trans 'Add abon' %} - - {% endif %} - - {% trans 'Refresh subscribers on NAS' %} - - - {% trans 'Tariffs in groups' %} - -
+ {{ human.username }} + {{ human.ip_address|default:_('Not assigned') }} + {{ human.fio }} + {{ human.street|default:_('Not assigned') }} + {{ human.house|default:_('Not assigned') }} + {{ human.telephone }} + + {% if human.active_tariff %} + {% if perms.tariff_app.change_tariff %} + {{ human.active_tariff.title }} + {% else %} + {{ human.active_tariff.title }} + {% endif %} + {% else %}——— + {% endif %} + + {{ human.ballance }} + + {% if perms.abonapp.delete_abon %} + + + + {% endif %} + + + {% empty %} + + + {% trans 'Subscribers not found' %}. + {% if perms.abonapp.add_abon %} + {% trans 'Add abon' %} + {% endif %} + + + {% endfor %} + + + + + {% if perms.abonapp.add_abon %} + + {% trans 'Add abon' %} + + {% endif %} + + {% trans 'Refresh subscribers on NAS' %} + + + {% trans 'Tariffs in groups' %} + + + + + +
+ + {% include 'toolbar_page.html' with pag=peoples %} diff --git a/abonapp/views.py b/abonapp/views.py index b0f8582..3a44b82 100644 --- a/abonapp/views.py +++ b/abonapp/views.py @@ -22,7 +22,11 @@ import mydefs @login_required @mydefs.only_admins def peoples(request, gid): - peoples_list = models.Abon.objects.filter(group=gid) + street_id = mydefs.safe_int(request.GET.get('street')) + if street_id > 0: + peoples_list = models.Abon.objects.filter(group=gid, street=street_id) + else: + peoples_list = models.Abon.objects.filter(group=gid) # фильтр dr, field = mydefs.order_helper(request) @@ -31,9 +35,13 @@ def peoples(request, gid): peoples_list = mydefs.pag_mn(request, peoples_list) + streets = models.AbonStreet.objects.filter(group=gid) + return render(request, 'abonapp/peoples.html', { 'peoples': peoples_list, 'abon_group': get_object_or_404(models.AbonGroup, pk=gid), + 'streets': streets, + 'street_id': street_id, 'dir': dr, 'order_by': request.GET.get('order_by') })