fix select_by_acl to return a queryset
diff --git a/planetstack/core/models/site.py b/planetstack/core/models/site.py
index 072b288..b86b7c4 100644
--- a/planetstack/core/models/site.py
+++ b/planetstack/core/models/site.py
@@ -116,13 +116,15 @@
return False
- def select_by_acl(self, user):
- acl = self.get_acl()
- result = []
+ @staticmethod
+ def select_by_acl(user):
+ ids = []
for deployment in Deployment.objects.all():
+ acl = deployment.get_acl()
if acl.test(user):
- result.append(deployment)
- return result
+ ids.append(deployment.id)
+
+ return Deployment.objects.filter(id__in=ids)
def __unicode__(self): return u'%s' % (self.name)