Example #1
0
def summary(request):
    if request.method == 'POST':
        form = orgform(request.POST)

    if form.is_valid():
        org_id = form.cleaned_data['organization']
        orgname = cli_ax.objects.filter(id=org_id)[0].org
        monthly = det_ax.objects.values("month").distinct()
        yearly = det_ax.objects.values("year").distinct()

        newdict = []
        for y in monthly:
            for z in yearly:
                a = det_ax.objects.filter(org=orgname).filter(
                    month=y["month"]).filter(year=z["year"]).count()
                b = det_ax.objects.filter(org=orgname).filter(
                    month=y["month"]).filter(
                        year=z["year"]).values('ip').distinct()
                if a > 0:
                    newdict.append([
                        y["month"], " ", z["year"], " => ", " Unique: IPs: ",
                        len(b), "/ Session IDs:  ", a
                    ])
    return render(request, 'jaxapp/summary_view.html', {
        "sum_dict": newdict,
        'ip_name': orgname
    })
Example #2
0
def home(request):
    form = orgform()
    textform = commentform()
    return render(request, 'jaxapp/index.html', {
        'dropdownform': form,
        'anotherform': textform
    })
Example #3
0
def form_view(request):
    if request.method == 'POST':
        form = orgform(request.POST)

        if form.is_valid():
            organization = form.cleaned_data['organization']
            y = jcanalytics.objects.filter(id=organization)
            x = y[0].org
            z = analytics.objects.filter(org=x)

            return render(request, 'JAXapp/name.html', {'jcform2': z})
Example #4
0
def ip_add(request):
    if request.method == 'POST':
        form = orgform(request.POST)

    if form.is_valid():
        org_id = form.cleaned_data['organization']
        orgname = cli_ax.objects.filter(id=org_id)[0].org
        ip_data = det_ax.objects.filter(org=orgname).values('ip').distinct()
        count_data = det_ax.objects.filter(org=orgname).values('ip').distinct().count()

    return render(request, 'jaxapp/ip_add.html', ({'ip_details' : ip_data, 'ip_name' : orgname, 'count' : count_data}))
Example #5
0
def detail(request):
    if request.method == 'POST':
        form =  orgform(request.POST)

    if form.is_valid():
        org_id = form.cleaned_data['organization']
        orgname = cli_ax.objects.filter(id=org_id)[0].org
        detail_data = det_ax.objects.filter(org=orgname).order_by('-time')
        count_data = det_ax.objects.filter(org=orgname).count()

    return render(request, 'jaxapp/detail_view.html', {'detail_form' : detail_data, 'ip_name' : orgname,'count' : count_data})
Example #6
0
def detail(request):
    if request.method == 'POST':
        form = orgform(request.POST)

    if form.is_valid():
        org_id = form.cleaned_data['organization']
        orgname = cli_ax.objects.filter(id=org_id)[0].org
        detail_data = det_ax.objects.filter(org=orgname)
        count_data = det_ax.objects.filter(org=orgname).count()

    return render(request, 'jaxapp/detail_view.html', {
        'detail_form': detail_data,
        'ip_name': orgname,
        'count': count_data
    })
Example #7
0
def ip_add(request):
    if request.method == 'POST':
        form = orgform(request.POST)

    if form.is_valid():
        org_id = form.cleaned_data['organization']
        orgname = cli_ax.objects.filter(id=org_id)[0].org
        ip_data = det_ax.objects.filter(org=orgname).values('ip').distinct()
        count_data = det_ax.objects.filter(
            org=orgname).values('ip').distinct().count()

    return render(request, 'jaxapp/ip_add.html', ({
        'ip_details': ip_data,
        'ip_name': orgname,
        'count': count_data
    }))
Example #8
0
def summary(request):
    if request.method == 'POST':
        form = orgform(request.POST)

    if form.is_valid():
        org_id = form.cleaned_data['organization']
        orgname = cli_ax.objects.filter(id=org_id)[0].org
        monthly = det_ax.objects.values("month").distinct()
        yearly = det_ax.objects.values("year").distinct()

        newdict = []
        for y in monthly:
            for z in yearly:
                a = det_ax.objects.filter(org=orgname).filter(
                    month=y["month"]).filter(year=z["year"]).count()
                b = det_ax.objects.filter(org=orgname).filter(
                    month=y["month"]).filter(
                        year=z["year"]).values('ip').distinct()
                if a > 0:
                    newdict.append([
                        y["month"], " ", z["year"], " => ", " Unique: IPs: ",
                        len(b), "/ Session IDs:  ", a
                    ])

                dm = {
                    'Jan': 12,
                    'Feb': 11,
                    'Mar': 10,
                    'Apr': 9,
                    'May': 8,
                    'Jun': 7,
                    'Jul': 6,
                    'Aug': 5,
                    'Sep': 4,
                    'Oct': 3,
                    'Nov': 2,
                    'Dec': 1
                }
                dy = {'2017': 1, '2016': 2, '2015': 3}

                newdict.sort(key=lambda x: (dy[x[2]], dm[x[0]]))
                print newdict
    return render(request, 'jaxapp/summary_view.html', {
        "sum_dict": newdict,
        'ip_name': orgname
    })
Example #9
0
def summary(request):
    if request.method == 'POST':
        form = orgform(request.POST)

    if form.is_valid():
      org_id = form.cleaned_data['organization']
      orgname = cli_ax.objects.filter(id=org_id)[0].org
      monthly = det_ax.objects.values("month").distinct()
      yearly = det_ax.objects.values("year").distinct()

      newdict = []
      for y in monthly:
        for z in yearly:
            a = det_ax.objects.filter(org=orgname).filter(month=y["month"]).filter(year=z["year"]).count()
            b = det_ax.objects.filter(org=orgname).filter(month=y["month"]).filter(year=z["year"]).values('ip').distinct()
            if a > 0:
                newdict.append([y["month"], " ", z["year"], " => ", " Unique: IPs: ", len(b), "/ Session IDs:  ", a])

            dm = {'Jan':12,'Feb':11,'Mar':10,'Apr':9,'May':8,'Jun':7,'Jul':6,'Aug':5,'Sep':4,'Oct':3,'Nov':2,'Dec':1}
            dy = {'2017':1,'2016':2,'2015':3}

            newdict.sort(key=lambda x: (dy[x[2]], dm[x[0]]))
            print newdict
    return render(request, 'jaxapp/summary_view.html', {"sum_dict" : newdict, 'ip_name' : orgname})
Example #10
0
def site(request):
    form = orgform()
    return render(request, 'JAXapp/index.html', {'jcform': form})
Example #11
0
def home(request):
    form = orgform()
    textform = commentform()
    return render(request, 'jaxapp/index.html', {'dropdownform': form, 'anotherform': textform})