Skip to content

Commit

Permalink
Add distinct to hostname filters (#2757)
Browse files Browse the repository at this point in the history
  • Loading branch information
ar4s committed Aug 23, 2016
1 parent a132894 commit e77e5c2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/ralph/admin/filters.py
Expand Up @@ -547,7 +547,7 @@ def queryset(self, request, queryset):
Q(hostname__icontains=self.value()) |
Q(ethernet_set__ipaddress__hostname__icontains=self.value())
]
return queryset.filter(*queries)
return queryset.filter(*queries).distinct()

def lookups(self, request, model_admin):
return (
Expand Down
2 changes: 1 addition & 1 deletion src/ralph/data_center/admin.py
Expand Up @@ -97,7 +97,7 @@ def queryset(self, request, queryset):
Q(**{'{}__icontains'.format(field): self.value()})
for field in fields
]
return queryset.filter(reduce(operator.or_, queries))
return queryset.filter(reduce(operator.or_, queries)).distinct()

def lookups(self, request, model_admin):
return (
Expand Down

0 comments on commit e77e5c2

Please sign in to comment.