Show all mnt objects on dashboard, too

This commit is contained in:
Sebastian Lohff 2017-10-12 21:28:42 +02:00
parent 6557250bc1
commit 2f3fa061af
1 changed files with 4 additions and 0 deletions

View File

@ -40,6 +40,10 @@ def profile(request):
def dashboard(request): def dashboard(request):
mnts = request.user.maintainer_set.all() mnts = request.user.maintainer_set.all()
ownMnts = request.user.maintainer_set.filter(rir=False, lir=False).all().distinct() ownMnts = request.user.maintainer_set.filter(rir=False, lir=False).all().distinct()
# if account only has rir/lir objects, show them
if ownMnts.count() == 0:
ownMnts = mnts
asns = ASNumber.objects.filter(Q(mnt_by__in=ownMnts) | Q(mnt_lower__in=ownMnts)).distinct() asns = ASNumber.objects.filter(Q(mnt_by__in=ownMnts) | Q(mnt_lower__in=ownMnts)).distinct()
inetnums = InetNum.objects.filter(Q(mnt_by__in=ownMnts) | Q(mnt_lower__in=ownMnts)).distinct() inetnums = InetNum.objects.filter(Q(mnt_by__in=ownMnts) | Q(mnt_lower__in=ownMnts)).distinct()
domains = Domain.objects.filter(mnt_by__in=mnts).distinct() domains = Domain.objects.filter(mnt_by__in=mnts).distinct()