2017-02-10 02:45:45 +01:00
|
|
|
from django.shortcuts import render
|
2017-02-14 22:26:16 +01:00
|
|
|
from django.contrib.auth.decorators import login_required
|
2017-03-15 03:07:43 +01:00
|
|
|
from django.db.models import Q
|
|
|
|
|
|
|
|
from whoisdb.models import ASNumber, InetNum
|
|
|
|
from domains.models import Domain
|
|
|
|
from rrequests.models import Request
|
|
|
|
|
2017-02-10 02:45:45 +01:00
|
|
|
|
2017-02-14 22:26:16 +01:00
|
|
|
@login_required
|
|
|
|
def profile(request):
|
|
|
|
return render(request, "profile/profile.html", {})
|
|
|
|
|
2017-03-15 03:07:43 +01:00
|
|
|
|
2017-02-14 22:26:16 +01:00
|
|
|
@login_required
|
|
|
|
def dashboard(request):
|
2017-03-15 03:07:43 +01:00
|
|
|
mnts = request.user.maintainer_set.all()
|
|
|
|
asns = ASNumber.objects.filter(Q(mnt_by__in=mnts) | Q(mnt_lower__in=mnts))
|
|
|
|
inetnums = InetNum.objects.filter(Q(mnt_by__in=mnts) | Q(mnt_lower__in=mnts))
|
|
|
|
domains = Domain.objects.filter(mnt_by__in=mnts)
|
|
|
|
rrequests = Request.objects.filter((Q(provider__in=mnts) | Q(applicant__in=mnts)) & Q(status=Request.STATE_OPEN))
|
|
|
|
|
|
|
|
return render(request, "dncore/dashboard.html", {"asns": asns, "inetnums": inetnums, "domains": domains, 'rrequests': rrequests})
|
|
|
|
|
2017-02-14 22:26:16 +01:00
|
|
|
|
|
|
|
def index(request):
|
|
|
|
return render(request, "index.html", {})
|