Add empty object_list support to the 'filter_objects_by_access' manager method
This commit is contained in:
@@ -274,6 +274,14 @@ class AccessEntryManager(models.Manager):
|
|||||||
if actor.is_superuser or actor.is_staff:
|
if actor.is_superuser or actor.is_staff:
|
||||||
return object_list
|
return object_list
|
||||||
|
|
||||||
|
try:
|
||||||
|
if object_list.count() == 0:
|
||||||
|
return object_list
|
||||||
|
except TypeError:
|
||||||
|
# object_list is not a queryset
|
||||||
|
if len(object_list) == 0:
|
||||||
|
return object_list
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Try to process as a QuerySet
|
# Try to process as a QuerySet
|
||||||
qs = object_list.filter(pk__in=[obj.pk for obj in self.get_allowed_class_objects(permission, actor, object_list[0])])
|
qs = object_list.filter(pk__in=[obj.pk for obj in self.get_allowed_class_objects(permission, actor, object_list[0])])
|
||||||
|
|||||||
Reference in New Issue
Block a user