console/SWSCloudCore/controllers/containers/manage.py

24 lines
692 B
Python
Raw Permalink Normal View History

2016-04-02 00:42:22 +03:00
from SWSCloudCore import models
class ControllerManageContainers:
def get_all_items(self):
query = models.Containers.select()
containers = dict()
containers["total"] = query.count()
containers["items"] = []
for item in query.execute():
containers['items'].append(item)
return containers
def get_user_items(self, user_id):
query = models.Containers.select().where(models.Containers.user == user_id)
containers = dict()
containers["total"] = query.count()
containers["items"] = []
for item in query.execute():
containers['items'].append(item)
return containers