Skip to main content

django-import-export-extensions

GitHub last commit GitHub Workflow Status (with event) Coverage Status PyPI PyPI - Status PyPI - Python Version PyPI - Django Versions PyPI - License PyPI - Downloads Ruff prek

Check out our other open-source projects

Links

Description

django-import-export-extensions extends the functionality of django-import-export adding the following features:

  • Import/export resources in the background via Celery
  • Manage import/export jobs via Django Admin
  • DRF integration that allows to work with import/export jobs via API
  • Support drf-spectacular generated API schema
  • Additional fields and widgets (FileWidget, IntermediateManyToManyWidget, IntermediateManyToManyField)

Installation

To install django-import-export-extensions, run this command in your terminal:

pip install django-import-export-extensions

Add import_export and import_export_extensions to INSTALLED_APPS

# settings.py
INSTALLED_APPS = (
    ...,
    "import_export",
    "import_export_extensions",
)

Run migrate command to create ImportJob/ExportJob models and collectstatic to let Django collect package static files to use in the admin.

python manage.py migrate
python manage.py collectstatic

Usage

Prepare resource for your model

# apps/books/resources.py
from import_export_extensions.resources import CeleryModelResource

from .. import models


class BookResource(CeleryModelResource):

    class Meta:
        model = models.Book

Use CeleryImportExportMixin class and set resource_classes in admin model to import/export via Django Admin

# apps/books/admin.py
from django.contrib import admin

from import_export_extensions.admin import CeleryImportExportMixin

from .. import resources


@admin.register(models.Book)
class BookAdmin(CeleryImportExportMixin, admin.ModelAdmin):
    resource_classes = [resources.BookResource]

Prepare view sets to import/export via API

# apps/books/api/views.py
from .. import resources

from import_export_extensions.api import views


class BookExportViewSet(views.ExportJobViewSet):
    resource_class = resources.BookResource


class BookImportViewSet(views.ImportJobViewSet):
    resource_class = resources.BookResource

Don't forget to configure Celery if you want to run import/export in background

License

  • Free software: MIT license

Metadata

Release files for django-import-export-extensions 1.10.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-import-export-extensions 1.10.3
File Size Uploaded
django_import_export_extensions-1.10.3.tar.gz 722.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-import-export-extensions 1.10.3
File Interpreter ABI Platform
django_import_export_extensions-1.10.3-py3-none-any.whl Python 3 none any Details

Total release size: 800.6 kB

Release files / django_import_export_extensions-1.10.3.tar.gz

Download URL django_import_export_extensions-1.10.3.tar.gz
Size 722.5 kB
Tags Source
SHA-256 checksum
How to use checksums
cb6d5adc36633593896f36078396ca96a7e1b9ea7064d1bd5f60543b09aca0f1
BLAKE2b-256 checksum
How to use checksums
3227a95391d8fad43a035b18eb7a690b4bc973860949317d55cf0cdbe0f5a3fb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / django_import_export_extensions-1.10.3-py3-none-any.whl

Download URL django_import_export_extensions-1.10.3-py3-none-any.whl
Size 78.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4a08af7199678beb2a63e0b6f4a26a5719caa74a9034e88582dc7340637a2581
BLAKE2b-256 checksum
How to use checksums
95660444ec4f7d150f2f7ce0db86450413a9ee1f250b1c45b38e440cb25efbcd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page