def get_context_data(self, **kwargs): return super().get_context_data( sqlite=otree.common.is_sqlite(), debug=settings.DEBUG, auth_level=settings.AUTH_LEVEL, auth_level_ok=settings.AUTH_LEVEL in {'DEMO', 'STUDY'}, db_synced=not missing_db_tables(), pypi_results=get_installed_and_pypi_version(), **kwargs, )
def __call__(self, request): if not CheckDBMiddleware.synced: # very fast, 0.01-0.02 seconds for the whole check missing_tables = missing_db_tables() if missing_tables: listed_tables = missing_tables[:3] unlisted_tables = missing_tables[3:] msg = ( "Your database is not ready. Try resetting the database " "(Missing tables for {}, and {} other models). ").format( ', '.join(listed_tables), len(unlisted_tables)) return HttpResponseServerError(msg) else: CheckDBMiddleware.synced = True return self.get_response(request)