diff --git a/pandora/clip/models.py b/pandora/clip/models.py index a51f148ad..24801ddc8 100644 --- a/pandora/clip/models.py +++ b/pandora/clip/models.py @@ -116,7 +116,7 @@ attrs = { 'aspect_ratio': models.FloatField(default=0), 'item': models.ForeignKey('item.Item', related_name='clips'), - 'sort': models.ForeignKey('item.ItemSort', related_name='clips'), + 'sort': models.ForeignKey('item.ItemSort', related_name='matching_clips'), 'user': models.IntegerField(db_index=True, null=True), #seconds diff --git a/pandora/item/managers.py b/pandora/item/managers.py index 74bb554b4..48deefa16 100644 --- a/pandora/item/managers.py +++ b/pandora/item/managers.py @@ -307,6 +307,9 @@ class ItemManager(Manager): #users can see public items, there own items and items of there groups else: allowed_level = settings.CONFIG['capabilities']['canSeeItem'][user.get_profile().get_level()] - qs = qs.filter(Q(level__lte=allowed_level)|Q(user=user)|Q(groups__in=user.groups.all())) + q = Q(level__lte=allowed_level)|Q(user=user) + if user.groups.count(): + q |= Q(groups__in=user.groups.all()) + qs = qs.filter(q) #admins can see all available items return qs