Offer way back from rir/lir view

This commit is contained in:
Sebastian Lohff 2017-10-12 21:31:03 +02:00
parent 2f3fa061af
commit 3c031030a6
2 changed files with 8 additions and 1 deletions

View File

@ -13,7 +13,11 @@
<p>
You can create new database objects <a href="{% url "whoisdb:createObjectOverview" %}">here</a>.
{% if hasDelegations %}
{% if not showDelegations %}
See <a href="?delegated=1">also lir/rir objects</a>.
{% else %}
See <a href="?">only non-lir/rir objects</a>.
{% endif %}
{% endif %}
</p>

View File

@ -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):