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 27e1a35e5a
commit aec578d619
1 changed files with 3 additions and 1 deletions

View File

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