From 62c3b56ef9015433e7ee437cb90b24a4401414ab Mon Sep 17 00:00:00 2001 From: bashmak Date: Thu, 11 May 2017 13:12:22 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B4=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB?= =?UTF-8?q?=D0=B2=D1=8B=D0=B2=D0=BE=D0=B4=20=D0=BA=D0=BB=D1=8E=D1=87=D0=B5?= =?UTF-8?q?=D0=B9=20=D1=81=D0=BE=D1=81=D1=82=D0=BE=D1=8F=D0=BD=D0=B8=D1=8F?= =?UTF-8?q?=20=D0=B0=D0=B1=D0=BE=D0=BD=D0=B5=D0=BD=D1=82=D0=BE=D0=B2=20?= =?UTF-8?q?=D0=BF=D0=BE=20=D1=82=D1=80=D0=B0=D1=84=D0=B8=D0=BA=D1=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- abonapp/views.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/abonapp/views.py b/abonapp/views.py index c25a18e..b6218f9 100644 --- a/abonapp/views.py +++ b/abonapp/views.py @@ -11,6 +11,7 @@ from django.http import HttpResponse from django.contrib import messages from django.utils.translation import ugettext_lazy as _ +from statistics.models import getModel from tariff_app.models import Tariff from agent import NasFailedResult, Transmitter, NasNetworkError from . import forms @@ -29,12 +30,20 @@ def peoples(request, gid): else: peoples_list = models.Abon.objects.filter(group=gid) + StatModel = getModel() + # фильтр dr, field = mydefs.order_helper(request) if field: peoples_list = peoples_list.order_by(field) peoples_list = mydefs.pag_mn(request, peoples_list) + for abon in peoples_list: + if abon.ip_address is not None: + traf = StatModel.objects.traffic_by_ip( abon.ip_address ) + if traf[1] is not None: + abon.traf = traf[1] + abon.is_online =traf[0] streets = models.AbonStreet.objects.filter(group=gid)