Advertisement
Guest User

Untitled

a guest
Oct 14th, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.04 KB | None | 0 0
  1. from model_service import Service
  2. from model_company import Company
  3.  
  4. class Portal(object):
  5.     @staticmethod
  6.     def create_service(service_name):
  7.         #there is logic of getting service guid from plugin datatbase
  8.         plugin = None #Plugin.get(name=service_name)
  9.         param = {
  10.             "name": service_name,
  11.             "guid": plugin.guid,
  12.             "version": plugin.version,
  13.             "company_company_id": None, #connect to the company will be later
  14.         }
  15.         new_service = Service(**param)
  16.         return new_service
  17.        
  18.     @staticmethod
  19.     def create_company(company_name):
  20.         current_user = None #implement it in future i want to ovveride Proadmin current user that get our account
  21.         param = {
  22.             "name": company_name,
  23.             "description": "",
  24.             "pis_code": "",
  25.             "post_code": "",
  26.             "address": "",
  27.             "color": "",
  28.             "town": "",
  29.             "email": "",
  30.             "contact_name": "",
  31.             "account_account_id": current_user.id
  32.         }
  33.         new_company = Company(**param)
  34.         return new_company
  35.        
  36.     @staticmethod
  37.     def get_service(service_name):
  38.         service = Service.get(name=service_name)
  39.         return service
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement