diff --git a/templates/whoisdb/overview.html b/templates/whoisdb/overview.html index 54fabf2..27ccf65 100644 --- a/templates/whoisdb/overview.html +++ b/templates/whoisdb/overview.html @@ -13,7 +13,11 @@

You can create new database objects here. {% if hasDelegations %} + {% if not showDelegations %} See also lir/rir objects. + {% else %} + See only non-lir/rir objects. + {% endif %} {% endif %}

diff --git a/whoisdb/views.py b/whoisdb/views.py index 61c551a..3f1898f 100644 --- a/whoisdb/views.py +++ b/whoisdb/views.py @@ -29,6 +29,9 @@ def dbDashboard(request): if request.GET.get("delegated", None) or mnts.count() == 0: # if user wants to see rir/lir objects or only has rir/lir mnts, use all available mnts mnts = request.user.maintainer_set.all() + showDelegations = True + else: + showDelegations = False hasDelegations = request.user.maintainer_set.filter(Q(rir=True) | Q(lir=True)).count() > 0 @@ -64,7 +67,7 @@ def dbDashboard(request): mntForm = MntInitialForm(user=request.user, prefix="mnt", initial={'handle': 'AUTO', 'description': 'Primary maintainer of %s' % request.user.username}) contactForm = ContactInitialForm(user=request.user, initial={'handle': 'AUTO', 'name': request.user.username.capitalize()}, prefix='contact') - return render(request, "whoisdb/overview.html", {"mnts": mnts, "contacts": contacts, "mntForm": mntForm, "contactForm": contactForm, "netblocks": netblocks, "asblocks": asblocks, "asnumbers": asnumbers, 'hasDelegations': hasDelegations}) + return render(request, "whoisdb/overview.html", {"mnts": mnts, "contacts": contacts, "mntForm": mntForm, "contactForm": contactForm, "netblocks": netblocks, "asblocks": asblocks, "asnumbers": asnumbers, 'hasDelegations': hasDelegations, "showDelegations": showDelegations}) def showHandle(request, handle):