hotfix: owner can be None

This commit is contained in:
Qwann 2018-08-20 15:18:54 +02:00
parent 20fad42d6d
commit 7690c1a8ab

View file

@ -51,7 +51,8 @@ class EquipmentFilter(django_filters.FilterSet):
if self.queryset is not None: if self.queryset is not None:
for filter_ in self.filters.values(): for filter_ in self.filters.values():
if filter_.queryset.model == Group: if filter_.queryset.model == Group:
own_ids = [eq.owner.id for eq in self.queryset] own_ids = [eq.owner.id for eq in self.queryset
if eq.owner is not None]
filtre = Q(id__lt=0) filtre = Q(id__lt=0)
for own_id in own_ids: for own_id in own_ids:
filtre |= Q(id=own_id) filtre |= Q(id=own_id)