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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_import_export_extensions-1.10.3.tar.gz (722.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file django_import_export_extensions-1.10.3.tar.gz.

File metadata

  • Download URL: django_import_export_extensions-1.10.3.tar.gz
  • Upload date:
  • Size: 722.5 kB
  • Tags: Source
  • Uploaded using 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}

File hashes

Hashes for django_import_export_extensions-1.10.3.tar.gz
Algorithm Hash digest
SHA256 cb6d5adc36633593896f36078396ca96a7e1b9ea7064d1bd5f60543b09aca0f1
MD5 104447f4e47178173636344539ca71c4
BLAKE2b-256 3227a95391d8fad43a035b18eb7a690b4bc973860949317d55cf0cdbe0f5a3fb

See more details on using hashes here.

File details

Details for the file django_import_export_extensions-1.10.3-py3-none-any.whl.

File metadata

  • Download URL: django_import_export_extensions-1.10.3-py3-none-any.whl
  • Upload date:
  • Size: 78.1 kB
  • Tags: Python 3
  • Uploaded using 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}

File hashes

Hashes for django_import_export_extensions-1.10.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4a08af7199678beb2a63e0b6f4a26a5719caa74a9034e88582dc7340637a2581
MD5 21b9d1f3199b200246691687a7b5c26e
BLAKE2b-256 95660444ec4f7d150f2f7ce0db86450413a9ee1f250b1c45b38e440cb25efbcd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page