def auth_user(): global _hasCreated if not _hasCreated: helpers.define_model( "auth_user", [["username"]], username=helpers.create_field("text", True), first_name=helpers.create_field("text", True), # link to last_name=helpers.create_field("text", True), is_active=helpers.create_field("bool", True), email=helpers.create_field("text", True), is_superuser=helpers.create_field("bool", True), is_staff=helpers.create_field("bool", True), last_login=helpers.create_field("date"), date_joined=helpers.create_field("date")) _hasCreated = True ret = applications.get_settings().database.collection("auth_user") return ret
def sys_customers(): global _hasCreated if not _hasCreated: helpers.define_model( "customers", [["code"]], code=helpers.create_field("text", True), # link to sys_multi_tenancy name=helpers.create_field("text", True), contact_info=dict( address=helpers.create_field("text", True), email=helpers.create_field("text", True), ), admin_user=helpers.create_field("text", True), # link to auth_user ) _hasCreated = True ret = applications.get_settings().database.collection("customers") # ret.turn_never_use_schema_on() return ret
def sys_customers(): global _hasCreated if not _hasCreated: helpers.define_model( "customers", [["code"]], code=helpers.create_field("text", True) , # link to sys_multi_tenancy name=helpers.create_field("text", True), contact_info=dict( address=helpers.create_field("text", True), email=helpers.create_field("text", True), ), admin_user=helpers.create_field("text", True),# link to auth_user ) _hasCreated=True ret = applications.get_settings().database.collection("customers") # ret.turn_never_use_schema_on() return ret
def auth_user(): global _hasCreated if not _hasCreated: helpers.define_model( "auth_user", [["username"]], username=helpers.create_field("text", True), first_name=helpers.create_field("text", True) , # link to last_name=helpers.create_field("text", True), is_active=helpers.create_field("bool", True), email=helpers.create_field("text", True), is_superuser=helpers.create_field("bool", True), is_staff=helpers.create_field("bool", True), last_login =helpers.create_field("date"), date_joined =helpers.create_field("date") ) _hasCreated=True ret = applications.get_settings().database.collection("auth_user") return ret
def sys_multi_tenancy(): # type: () -> database.collection """ this model is the flection on 'sys_multi_tenancy' in mongodb. Just have 2 fields, no more... :return: """ global _hasCreated if not _hasCreated: helpers.define_model( "sys_multi_tenancy", [ ["code"], ["schema"] ], code= helpers.create_field("text",True), schema= helpers.create_field("text",True), ) _hasCreated=True ret = applications.get_settings().database.collection("sys_multi_tenancy") ret.turn_never_use_schema_on() return ret
def sys_multi_tenancy(): # type: () -> database.collection """ this model is the flection on 'sys_multi_tenancy' in mongodb. Just have 2 fields, no more... :return: """ import sys settings = sys.modules["settings"] global _hasCreated if not _hasCreated: helpers.define_model( settings.MULTI_TENANCY_CONFIGURATION["collection"], [["code"], ["schema"]], code=helpers.create_field("text", True), schema=helpers.create_field("text", True), ) _hasCreated = True ret = applications.get_settings().database.collection( settings.MULTI_TENANCY_CONFIGURATION["collection"]) ret.turn_never_use_schema_on() return ret