Metadata-Version: 2.4
Name: django-import-export-extensions
Version: 1.10.1
Summary: Extend functionality of `django-import-export`
Project-URL: Documentation, https://saritasa-nest.github.io/django-import-export-extensions/
Project-URL: Repository, https://github.com/saritasa-nest/django-import-export-extensions
Project-URL: Changelog, https://saritasa-nest.github.io/django-import-export-extensions/changelog/
Project-URL: Releases, https://github.com/saritasa-nest/django-import-export-extensions/releases/
Project-URL: Bug Tracker, https://github.com/saritasa-nest/django-import-export-extensions/issues/
Project-URL: Contributing, https://saritasa-nest.github.io/django-import-export-extensions/contributing/
Author-email: Saritasa <pypi@saritasa.com>
Maintainer-email: Nikita Azanov <nikita.azanov@saritasa.com>, Andrey Otto <andrey.otto@saritasa.com>, Stanislav Khlud <stanislav.khlud@saritasa.com>, Egor Toryshak <egor.toryshak@saritasa.com>
License-Expression: MIT
License-File: LICENSE
Keywords: celery,csv,django,django_import_export_extensions,import_export,json,python,xlsx
Classifier: Framework :: Django
Classifier: Framework :: Django :: 4.2
Classifier: Framework :: Django :: 5.0
Classifier: Framework :: Django :: 5.1
Classifier: Framework :: Django :: 5.2
Classifier: Framework :: Django :: 6.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.10
Requires-Dist: celery>=5.4.0
Requires-Dist: django-extensions>=3.2.3
Requires-Dist: django-filter>=24.3
Requires-Dist: django-import-export[xls,xlsx]>=4.2
Requires-Dist: django-picklefield>3.2
Requires-Dist: django>=4.2
Requires-Dist: djangorestframework>3.15.2
Requires-Dist: drf-spectacular<1
Requires-Dist: requests>=2.32.3
Description-Content-Type: text/markdown

# django-import-export-extensions

![GitHub last commit](https://img.shields.io/github/last-commit/saritasa-nest/django-import-export-extensions)
![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/saritasa-nest/django-import-export-extensions/run_pre_commit.yaml)
![PyPI](https://img.shields.io/pypi/v/django-import-export-extensions)
![PyPI - Status](https://img.shields.io/pypi/status/django-import-export-extensions)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/django-import-export-extensions)
[![PyPI - Django Versions](https://img.shields.io/pypi/frameworkversions/django/django-import-export-extensions)](https://pypi.org/project/django-import-export-extensions/)
![PyPI - License](https://img.shields.io/pypi/l/django-import-export-extensions)
![PyPI - Downloads](https://img.shields.io/pypi/dm/django-import-export-extensions)
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)

## Links

- [Documentation](https://saritasa-nest.github.io/django-import-export-extensions/)
- [GitHub](https://github.com/saritasa-nest/django-import-export-extensions)
- [PyPI](https://pypi.org/project/django-import-export-extensions)
- [Contributing](https://saritasa-nest.github.io/django-import-export-extensions/contributing/)
- [Changelog](https://saritasa-nest.github.io/django-import-export-extensions/changelog/)

## Description

`django-import-export-extensions` extends the functionality of
[django-import-export](https://github.com/django-import-export/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](https://github.com/tfranzel/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:

```sh
pip install django-import-export-extensions
```

Add `import_export` and `import_export_extensions` to `INSTALLED_APPS`

```python
# 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.

```sh
python manage.py migrate
python manage.py collectstatic
```

## Usage

Prepare resource for your model

```python
# 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

```python
# 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

``` python
# 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](https://docs.celeryq.dev/en/stable/django/first-steps-with-django.html)
if you want to run import/export in background

## License

- Free software: MIT license
