def post_syncdb(sender, app, **kwargs): global have_already_installed if app == web and not have_already_installed: with custom_cache(): have_already_installed = True print "Installing esp.web initial data..." web.install()
def post_syncdb(sender, app, **kwargs): global have_already_installed if app == Modules and not have_already_installed: with custom_cache(): have_already_installed = True print "Installing esp.program.modules initial data..." Modules.install()
def post_syncdb(sender, app, **kwargs): global have_already_installed if app == datatree and not have_already_installed: with custom_cache(): have_already_installed = True # Check that required tables exist. if missing_db_table(program_models.ClassSubject, check_fields=False): raise Exception('DataTree post_syncdb missing table %s' % 'program_models.ClassSubject') if missing_db_table(users_models.UserBit, check_fields=False): raise Exception( 'Warning: DataTree post_syncdb missing table %s' % 'users_models.UserBit') print "Installing esp.datatree initial data..." datatree.install() from django.db import connection cursor = connection.cursor() f = open( os.path.join( settings.PROJECT_ROOT, "esp/datatree/sql/datatree.postgresql-multiline.sql")) cursor.execute(f.read()) f.close()
def post_syncdb(sender, app, **kwargs): global have_already_installed if (not have_already_installed) and app == cal: with custom_cache(): have_already_installed = True print "Installing esp.cal initial data..." cal.install()
def post_syncdb(sender, app, **kwargs): global have_already_installed if (not have_already_installed) and app == UsersModel: # Check that required tables exist. if missing_db_table(UsersModel.UserBit): return # Run installation with custom_cache(): have_already_installed = True print "Installing esp.users initial data..." UsersModel.install()
def post_syncdb(sender, app, **kwargs): global have_already_installed if app == program and not have_already_installed: with custom_cache(): # Check that required tables exist. if missing_db_table(program.Program) or missing_db_table( users.ContactInfo): return # Run installation have_already_installed = True print "Installing esp.program.class initial data..." class_models.install()
def post_syncdb(sender, app, **kwargs): global have_already_installed if (not have_already_installed) and app == UsersModel: # Check that required tables exist. if not db_table_exists('program_program'): return # Run installation with custom_cache(): have_already_installed = True print "Installing esp.users initial data..." UsersModel.install() print 'Adding PostgreSQL extensions...' with open(os.path.join(settings.PROJECT_ROOT, "esp/users/sql-extensions.sql")) as f: cursor = connection.cursor() cursor.execute(f.read())