@@ -72,22 +72,25 @@ def filter_groups(self, groups):
7272 return self .filter (memberships__in = memberships ).distinct ()
7373
7474 def filter_projects_for_task_or_view (self , instance ):
75- # if View/Task is not available it should not show for any project
76- if not instance .available :
77- return self .none ()
78-
7975 # projects that have an unavailable catalog should be disregarded
8076 qs = self .filter (catalog__available = True )
8177
82- # when instance.catalogs is empty it applies to all
78+ # when View/Task is not available it should not show for any project
79+ if not instance .available :
80+ return self .none ()
81+
82+ # when View/Task has any catalogs it can be filtered for those
8383 if instance .catalogs .exists ():
8484 qs = qs .filter (catalog__in = instance .catalogs .all ())
8585
86- # when instance.sites is empty it applies to all
86+ # when View/Task has any sites it can be filtered for those
8787 if instance .sites .exists ():
8888 qs = qs .filter (site__in = instance .sites .all ())
89+ elif settings .MULTISITE :
90+ # when View/Task has no sites in a multi-site, it should not appear at all
91+ return self .none ()
8992
90- # when instance.groups is empty it applies to all
93+ # when has any groups it can be filtered for those
9194 if instance .groups .exists ():
9295 qs = qs .filter_groups (instance .groups .all ())
9396
0 commit comments