How to use the cartoview.app_manager.config.CartoviewApp function in cartoview

To help you get started, we’ve selected a few cartoview examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cartologic / cartoview / cartoview / app_manager / installer.py View on Github external
def add_carto_app(self):
        if not CartoviewApp.objects.app_exists(self.name):
            CartoviewApp({
                'name': self.name,
                'active': True,
                'order': self.get_app_order(),
                'pending': True
            })
            CartoviewApp.save()
        else:
            carto_app = CartoviewApp.objects.get(self.name)
            carto_app.pending = True
            carto_app.commit()
            CartoviewApp.save()
github cartologic / cartoview / cartoview / app_manager / installer.py View on Github external
def add_carto_app(self):
        if not CartoviewApp.objects.app_exists(self.name):
            CartoviewApp({
                'name': self.name,
                'active': True,
                'order': self.get_app_order(),
                'pending': True
            })
            CartoviewApp.save()
        else:
            carto_app = CartoviewApp.objects.get(self.name)
            carto_app.pending = True
            carto_app.commit()
            CartoviewApp.save()
github cartologic / cartoview / cartoview / app_manager / urls.py View on Github external
def load_apps_urls():
    app_names = CartoviewApp.objects.get_active_apps().keys()
    for app_name in app_names:
        urlpatterns.append(app_url(app_name))
github cartologic / cartoview / cartoview / app_manager / config.py View on Github external
def __setattr__(self, name, value):
        if name == ['objects', 'app_attrs']:
            raise ValueError("{} should be altered using classname")
        if name not in CartoviewApp.app_attrs:
            raise AttributeError("attribute '{}' not found ".format(name))
        super(CartoviewApp, self).__setattr__(name, value)
github cartologic / cartoview / cartoview / app_manager / installer.py View on Github external
def _rollback(self):
        app = CartoviewApp.objects.pop(self.name, None)
        if app:
            CartoviewApp.save()
        self.delete_app_dir()
github cartologic / cartoview / cartoview / app_manager / apps_operations.py View on Github external
def execute_pending(self):
        from .config import CartoviewApp
        CartoviewApp.load()
        pending_apps = CartoviewApp.objects.get_pending_apps().values()
        for app in pending_apps:
            _pending_apps = self.get_pending_apps(app.name)
            if _pending_apps:
                for _app in _pending_apps:
                    _app_name = _app.get("name", None)
                    _make_migrations = _app.get("makemigrations", False)
                    _migrate = _app.get("migrate", False)
                    if _app_name:
                        if _make_migrations:
                            self.makemigrations(_app_name)
                        if _migrate:
                            self.migrate(_app_name)
            else:
                self.migrate(app)
            self.collectstatic()
github cartologic / cartoview / cartoview / app_manager / config.py View on Github external
def load(cls, apps_dir=None):
        if os.path.exists(cls.get_apps_json_path()):
            with portalocker.Lock(
                    cls.get_apps_json_path(apps_dir=apps_dir), 'r',
                    portalocker.LOCK_EX) as jf:
                data = jf.read()
                CartoviewApp.objects.from_json(data)