diff --git a/dncore/views.py b/dncore/views.py index 5053ab1..3d11c7d 100644 --- a/dncore/views.py +++ b/dncore/views.py @@ -1,13 +1,27 @@ from django.shortcuts import render from django.contrib.auth.decorators import login_required +from django.db.models import Q + +from whoisdb.models import ASNumber, InetNum +from domains.models import Domain +from rrequests.models import Request + @login_required def profile(request): return render(request, "profile/profile.html", {}) + @login_required def dashboard(request): - return render(request, "dncore/dashboard.html", {}) + 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}) + def index(request): return render(request, "index.html", {}) diff --git a/templates/base.html b/templates/base.html index 86353dd..fc2f371 100644 --- a/templates/base.html +++ b/templates/base.html @@ -53,6 +53,7 @@ Whois DB
diff --git a/templates/dncore/dashboard.html b/templates/dncore/dashboard.html index 24acbdd..e4c0dae 100644 --- a/templates/dncore/dashboard.html +++ b/templates/dncore/dashboard.html @@ -11,5 +11,94 @@ + +AS Name | +Number | +
---|---|
{{ asn.handle }} | +{{ asn.number }} | +
You don't have any AS numbers + {% endif %} + + {% if inetnums %} +
Net Name | +Prefix | +
---|---|
{{ inetnum.handle }} | +{{ inetnum.prefix }} | +
You don't have any AS numbers
+ {% endif %} + + +Domain | +
---|
{{ domain.name }} | +
You don't have any AS numbers
+ {% endif %} +From | +Subject | +
---|---|
{{ rrequest.applicant }} {{ rrequest.provider }} | +{{ rrequest.subject }} | +
No open requests
+ {% endif %} +