Browse Source

This query can return duplicates, add distinct()

pull/217/head
Pēteris Caune 6 years ago
parent
commit
02609ac05e
No known key found for this signature in database GPG Key ID: E28D7679E9A9EDE2
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      hc/accounts/models.py

+ 2
- 1
hc/accounts/models.py View File

@ -115,7 +115,8 @@ class Profile(models.Model):
is_owner = models.Q(owner=self.user)
is_member = models.Q(member__user=self.user)
return Project.objects.filter(is_owner | is_member).order_by("name")
q = Project.objects.filter(is_owner | is_member)
return q.distinct().order_by("name")
def checks_from_all_projects(self):
""" Return a queryset of checks from projects we have access to. """


Loading…
Cancel
Save