diff --git a/beat/web/utils/management/commands/restore.py b/beat/web/utils/management/commands/restore.py index bd710aea04de41fd05ca7b4ee8d3cd81c86f29ee..e7b769523bbcc651c3256b243f183d4a824a5ebe 100644 --- a/beat/web/utils/management/commands/restore.py +++ b/beat/web/utils/management/commands/restore.py @@ -37,7 +37,7 @@ import tempfile from django.core.management import call_command from django.core.management.base import BaseCommand, CommandError from django.conf import settings -from django.apps import apps +from django.apps import apps, registry from .backup import APPS @@ -102,6 +102,11 @@ class Command(BaseCommand): exclude = arguments.get('exclude') + # remove uninstalled apps + global APPS + installed_apps = registry.apps.all_models.keys() + exclude += [app for app in APPS if app not in installed_apps] + arguments = dict( verbosity=arguments.get('verbosity'), interactive=False,