From c42a854e75d69d607ff1d326c2af10e691f776c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C4=93teris=20Caune?= Date: Sat, 19 Jan 2019 19:08:06 +0200 Subject: [PATCH] Fix project names in the top navigation dropdown menu, avoid duplicates. --- hc/accounts/middleware.py | 2 +- templates/accounts/profile.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hc/accounts/middleware.py b/hc/accounts/middleware.py index 3a9521a6..0ee1c2e2 100644 --- a/hc/accounts/middleware.py +++ b/hc/accounts/middleware.py @@ -12,7 +12,7 @@ class TeamAccessMiddleware(object): is_owner = Q(owner=request.user) is_member = Q(member__user_id=request.user.id) - projects_q = Project.objects.filter(is_owner | is_member) + projects_q = Project.objects.filter(is_owner | is_member).distinct() projects_q = projects_q.select_related("owner") request.get_projects = lambda: list(projects_q) diff --git a/templates/accounts/profile.html b/templates/accounts/profile.html index 75143bb5..08fb85e4 100644 --- a/templates/accounts/profile.html +++ b/templates/accounts/profile.html @@ -324,7 +324,7 @@ class="form-control" id="team-name" name="team_name" - value="{{ profile }}"> + value="{{ project }}">