console/SWSCloudCore/controllers/plans/__init__.py

23 lines
598 B
Python

# coding: utf-8
from SWSCloudCore.models import PlansVMs
class ControllerPlans(object):
def get(self, status=None):
"""
Тарифные планы
:param status:
:return:
"""
if status:
return PlansVMs.select().where(PlansVMs.status == status)
return PlansVMs.select()
def plan_get(self, plan_id):
return PlansVMs.select().where(PlansVMs.id == plan_id).get()
def exists(self, plan_id):
if PlansVMs.select().where(PlansVMs.id == plan_id).count() == 0:
return False
return True