Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def set_active(self, active=True):
app = CartoviewApp.objects.get(self.name, None)
if app:
app.active = active
app.commit()
CartoviewApp.save()
return app
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()
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()
carto_app = CartoviewApp.objects.get(app.name)
carto_app.pending = False
carto_app.commit()
CartoviewApp.save()
def config(self):
return CartoviewApp.objects.get(self.name, None)
def dehydrate_pending(self, bundle):
app = bundle.obj
cartoview_app = CartoviewApp.objects.get(app.name)
return cartoview_app.pending