mirror of
https://github.com/inventree/InvenTree.git
synced 2026-11-28 10:34:34 +00:00
[bug] Fix for data import (#13367)
* [bug] Fix for data import Correctly skip plugin records (if requested) when importing data * Fix for data export * Updated CI workflow
This commit is contained in:
1 parent
65a8113baf
commit
5d24a3f327
5 files changed
+298
-14
No files matched your search
@@ -10,6 +10,26 @@ from django.core.management.base import BaseCommand
|
||||
class Command(BaseCommand):
|
||||
"""List all installed apps."""
|
||||
|
||||
def add_arguments(self, parser):
|
||||
"""Add command arguments."""
|
||||
parser.add_argument(
|
||||
'--labels',
|
||||
action='store_true',
|
||||
help='Output app labels (e.g. "auth") instead of full app names (e.g. "django.contrib.auth")',
|
||||
)
|
||||
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
group.add_argument(
|
||||
'--plugins-only',
|
||||
action='store_true',
|
||||
help='Only list apps which are provided by plugins',
|
||||
)
|
||||
group.add_argument(
|
||||
'--exclude-plugins',
|
||||
action='store_true',
|
||||
help='Do not list apps which are provided by plugins',
|
||||
)
|
||||
|
||||
def handle(self, *args, **kwargs):
|
||||
"""List all installed apps.
|
||||
|
||||
@@ -18,10 +38,24 @@ class Command(BaseCommand):
|
||||
"""
|
||||
from django.apps import apps
|
||||
|
||||
from plugin import registry
|
||||
|
||||
labels = kwargs.get('labels', False)
|
||||
plugins_only = kwargs.get('plugins_only', False)
|
||||
exclude_plugins = kwargs.get('exclude_plugins', False)
|
||||
|
||||
# Apps which have been added to INSTALLED_APPS by AppMixin plugins
|
||||
plugin_apps = set(registry.installed_apps)
|
||||
|
||||
app_list = []
|
||||
|
||||
for app in apps.get_app_configs():
|
||||
app_list.append(app.name)
|
||||
is_plugin = app.name in plugin_apps
|
||||
|
||||
if (plugins_only and not is_plugin) or (exclude_plugins and is_plugin):
|
||||
continue
|
||||
|
||||
app_list.append(app.label if labels else app.name)
|
||||
|
||||
app_list.sort()
|
||||
|
||||
|
||||
Reference in new issue
Block a user