How to use the cartoview.apps_handler.config.CartoviewApp.save 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 / rest.py View on Github external
def reorder(self, request, **kwargs):
        ids_list = request.POST.get("apps", None)
        if ids_list is not None:
            ids_list = ids_list.split(",")
        else:
            ids_list = json.loads(request.body)["apps"]
        for i in range(0, len(ids_list)):
            app = App.objects.get(id=ids_list[i])
            app.order = i + 1
            app.save()
            cartoview_app = CartoviewApp.objects.get(app.name)
            if cartoview_app:
                cartoview_app.order = app.order
                cartoview_app.commit()
            if i == (len(ids_list) - 1):
                CartoviewApp.save()
        self.log_throttled_access(request)
        return self.create_response(request, {'success': True})
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 / models.py View on Github external
def set_active(self, active=True):
        app = CartoviewApp.objects.get(self.name, None)
        if app:
            app.active = active
            app.commit()
            CartoviewApp.save()
        return app
github cartologic / cartoview / cartoview / apps_handler / apps_operations.py View on Github external
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()
            carto_app = CartoviewApp.objects.get(app.name)
            carto_app.pending = False
            carto_app.commit()
            CartoviewApp.save()
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 / installer.py View on Github external
def completely_remove(self):
        self.delete_app()
        self.delete_app_tables()
        self.delete_app_dir()
        CartoviewApp.objects.pop(self.name, None)
        CartoviewApp.save()