Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Import Wizard #6792

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions InvenTree/InvenTree/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,9 @@
INSTALLED_APPS = [
# Admin site integration
'django.contrib.admin',
# django data wizard
'data_wizard',
'data_wizard.sources',
# InvenTree apps
'build.apps.BuildConfig',
'common.apps.CommonConfig',
Expand Down Expand Up @@ -217,8 +220,8 @@
'django_filters', # Extended filter functionality
'rest_framework', # DRF (Django Rest Framework)
'corsheaders', # Cross-origin Resource Sharing for DRF
'crispy_forms', # Improved form rendering
'import_export', # Import / export tables to file
'crispy_forms', # Improved form rendering (TODO: Remove after migration to React)
'import_export', # Import / export tables to file (TODO: Remove after implementation of data-wizard)
'django_cleanup.apps.CleanupConfig', # Automatically delete orphaned MEDIA files
'mptt', # Modified Preorder Tree Traversal
'markdownify', # Markdown template rendering
Expand Down
2 changes: 2 additions & 0 deletions InvenTree/InvenTree/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,8 @@

urlpatterns += frontendpatterns

urlpatterns.append(path('datawizard/', include('data_wizard.urls')))

# Append custom plugin URLs (if plugin support is enabled)
if settings.PLUGINS_ENABLED:
urlpatterns.append(get_plugin_urls())
Expand Down
6 changes: 6 additions & 0 deletions InvenTree/InvenTree/wizard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
"""Target model registration for django-data-wizard.

Ref: https://django-data-wizard.wq.io/overview/setup#target-model-registration
"""

...
23 changes: 23 additions & 0 deletions InvenTree/part/wizard.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""Target model registration for django-data-wizard.

Each model we want to be able to import data into needs to be registered here.
"""

import data_wizard

from . import models, serializers

# Register the Part model serializers
data_wizard.register('Part', serializers.PartSerializer)
data_wizard.register('Part Category', serializers.CategorySerializer)
data_wizard.register('Part Parameter', serializers.PartParameterSerializer)
data_wizard.register('Part Test Template', serializers.PartTestTemplateSerializer)
data_wizard.register(
'Part Parameter Template', serializers.PartParameterTemplateSerializer
)
data_wizard.register(
'Category Parameter Template', serializers.CategoryParameterTemplateSerializer
)

# Register the BomItem model serializers
data_wizard.register('BOM Item', serializers.BomItemSerializer)
1 change: 1 addition & 0 deletions requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Django<5.0 # Django package
coreapi # API documentation for djangorestframework
cryptography>=40.0.0,!=40.0.2 # Core cryptographic functionality
data-wizard # Data import wizard
django-allauth # SSO for external providers via OpenID
django-allauth-2fa # MFA / 2FA
django-cleanup # Automated deletion of old / unused uploaded files
Expand Down
18 changes: 17 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ cffi==1.16.0
# weasyprint
charset-normalizer==3.3.2
# via requests
click==8.1.7
# via itertable
coreapi==2.3.3
coreschema==0.0.4
# via coreapi
Expand All @@ -40,6 +42,7 @@ cryptography==42.0.4
# pyjwt
cssselect2==0.7.0
# via weasyprint
data-wizard==2.0.0
defusedxml==0.7.1
# via
# odfpy
Expand Down Expand Up @@ -122,6 +125,7 @@ django-weasyprint==2.2.2
django-xforwardedfor-middleware==2.0
djangorestframework==3.14.0
# via
# data-wizard
# dj-rest-auth
# djangorestframework-simplejwt
# drf-spectacular
Expand All @@ -140,6 +144,10 @@ googleapis-common-protos==1.62.0
grpcio==1.62.0
# via opentelemetry-exporter-otlp-proto-grpc
gunicorn==21.2.0
html-json-forms==1.1.1
# via
# data-wizard
# natural-keys
html5lib==1.1
# via weasyprint
icalendar==5.0.11
Expand All @@ -153,6 +161,8 @@ importlib-metadata==6.11.0
# opentelemetry-api
inflection==0.5.1
# via drf-spectacular
itertable==2.2.0
# via data-wizard
itypes==1.2.0
# via coreapi
jinja2==3.1.3
Expand All @@ -167,12 +177,16 @@ markuppy==1.14
# via tablib
markupsafe==2.1.5
# via jinja2
natural-keys==2.1.0
# via data-wizard
oauthlib==3.2.2
# via requests-oauthlib
odfpy==1.4.1
# via tablib
openpyxl==3.1.2
# via tablib
# via
# itertable
# tablib
opentelemetry-api==1.22.0
# via
# opentelemetry-exporter-otlp-proto-grpc
Expand Down Expand Up @@ -256,6 +270,7 @@ pypng==0.20220715.0
python-barcode==0.15.1
python-dateutil==2.8.2
# via
# data-wizard
# django-recurrence
# icalendar
python-dotenv==1.0.1
Expand Down Expand Up @@ -286,6 +301,7 @@ requests==2.31.0
# via
# coreapi
# django-allauth
# itertable
# opentelemetry-exporter-otlp-proto-http
# requests-oauthlib
requests-oauthlib==1.3.1
Expand Down
Loading