Show all mnts if only rir/lir mts available

This commit is contained in:
Sebastian Lohff 2017-10-12 21:18:24 +02:00
parent d6176d8756
commit 6557250bc1
1 changed files with 3 additions and 1 deletions

View File

@ -26,8 +26,10 @@ def createObjectOverview(request):
@login_required @login_required
def dbDashboard(request): def dbDashboard(request):
mnts = request.user.maintainer_set.filter(rir=False, lir=False).all() mnts = request.user.maintainer_set.filter(rir=False, lir=False).all()
if request.GET.get("delegated", None): 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() mnts = request.user.maintainer_set.all()
hasDelegations = request.user.maintainer_set.filter(Q(rir=True) | Q(lir=True)).count() > 0 hasDelegations = request.user.maintainer_set.filter(Q(rir=True) | Q(lir=True)).count() > 0
contacts = Contact.objects.filter(mnt_by__in=mnts) contacts = Contact.objects.filter(mnt_by__in=mnts)