# Django-import-export-extensions
[](https://pypi.org/project/django-import-export-extensions/)
[](https://pypi.org/project/django-import-export-extensions/)

[](https://github.com/saritasa-nest/django-import-export-extensions/actions/workflows/checks.yml)
[](https://coveralls.io/github/saritasa-nest/django-import-export-extensions?branch=main)
[](https://django-import-export-extensions.readthedocs.io/en/latest/?badge=latest)

## Links
- [Documentation](<https://django-import-export-extensions.readthedocs.io>)
- [GitHub](<https://github.com/saritasa-nest/django-import-export-extensions>)
- [PyPI](<https://pypi.org/project/django-import-export-extensions>)
- [Contibuting](<https://django-import-export-extensions.readthedocs.io/en/stable/contributing.html>)
- [History](https://django-import-export-extensions.readthedocs.io/en/stable/history.html)
## 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
Raw data
{
"_id": null,
"home_page": "https://github.com/saritasa-nest/django-import-export-extensions",
"name": "django-import-export-extensions",
"maintainer": "Nikita Azanov",
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": "nikita.azanov@saritasa.com",
"keywords": "python, json, django, csv, xlsx, celery, import_export, django_import_export_extensions",
"author": "Saritasa",
"author_email": "pypi@saritasa.com",
"download_url": "https://files.pythonhosted.org/packages/d6/3c/bb0c117844150cfa5b2d22ec8850a60072ad5b286a701d3a3ced2f34944c/django_import_export_extensions-1.4.0.tar.gz",
"platform": null,
"description": "# Django-import-export-extensions\n\n[](https://pypi.org/project/django-import-export-extensions/)\n[](https://pypi.org/project/django-import-export-extensions/)\n\n\n[](https://github.com/saritasa-nest/django-import-export-extensions/actions/workflows/checks.yml)\n[](https://coveralls.io/github/saritasa-nest/django-import-export-extensions?branch=main)\n[](https://django-import-export-extensions.readthedocs.io/en/latest/?badge=latest)\n\n \n\n## Links\n\n- [Documentation](<https://django-import-export-extensions.readthedocs.io>)\n- [GitHub](<https://github.com/saritasa-nest/django-import-export-extensions>)\n- [PyPI](<https://pypi.org/project/django-import-export-extensions>)\n- [Contibuting](<https://django-import-export-extensions.readthedocs.io/en/stable/contributing.html>)\n- [History](https://django-import-export-extensions.readthedocs.io/en/stable/history.html)\n\n## Description\n\n`django-import-export-extensions` extends the functionality of\n[django-import-export](https://github.com/django-import-export/django-import-export/)\nadding the following features:\n\n- Import/export resources in the background via Celery\n- Manage import/export jobs via Django Admin\n- DRF integration that allows to work with import/export jobs via API\n- Support [drf-spectacular](https://github.com/tfranzel/drf-spectacular) generated API schema\n- Additional fields and widgets (FileWidget, IntermediateManyToManyWidget, IntermediateManyToManyField)\n\n## Installation\n\nTo install `django-import-export-extensions`, run this command in your\nterminal:\n\n```sh\npip install django-import-export-extensions\n```\n\nAdd `import_export` and `import_export_extensions` to `INSTALLED_APPS`\n\n```python\n# settings.py\nINSTALLED_APPS = (\n ...,\n \"import_export\",\n \"import_export_extensions\",\n)\n```\n\nRun `migrate` command to create ImportJob/ExportJob models and\n`collectstatic` to let Django collect package static files to use in the\nadmin.\n\n```sh\npython manage.py migrate\npython manage.py collectstatic\n```\n\n## Usage\n\nPrepare resource for your model\n\n```python\n# apps/books/resources.py\nfrom import_export_extensions.resources import CeleryModelResource\n\nfrom .. import models\n\n\nclass BookResource(CeleryModelResource):\n\n class Meta:\n model = models.Book\n```\n\nUse `CeleryImportExportMixin` class and set `resource_classes` in admin\nmodel to import/export via Django Admin\n\n```python\n# apps/books/admin.py\nfrom django.contrib import admin\n\nfrom import_export_extensions.admin import CeleryImportExportMixin\n\nfrom .. import resources\n\n\n@admin.register(models.Book)\nclass BookAdmin(CeleryImportExportMixin, admin.ModelAdmin):\n resource_classes = [resources.BookResource]\n```\n\nPrepare view sets to import/export via API\n\n``` python\n# apps/books/api/views.py\nfrom .. import resources\n\nfrom import_export_extensions.api import views\n\n\nclass BookExportViewSet(views.ExportJobViewSet):\n resource_class = resources.BookResource\n\n\nclass BookImportViewSet(views.ImportJobViewSet):\n resource_class = resources.BookResource\n```\n\nDon't forget to [configure\nCelery](https://docs.celeryq.dev/en/stable/django/first-steps-with-django.html)\nif you want to run import/export in background\n\n## License\n\n- Free software: MIT license\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Extend functionality of `django-import-export`",
"version": "1.4.0",
"project_urls": {
"Documentation": "https://django-import-export-extensions.readthedocs.io",
"Homepage": "https://github.com/saritasa-nest/django-import-export-extensions",
"Repository": "https://github.com/saritasa-nest/django-import-export-extensions"
},
"split_keywords": [
"python",
" json",
" django",
" csv",
" xlsx",
" celery",
" import_export",
" django_import_export_extensions"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "72c230f513dddac277f6e154f926a9e29c214aff8b52bb9276b0dae022583c53",
"md5": "7303594839dca026610090404914a77c",
"sha256": "8f678da3fde6e60fd4794e7fac102e6bdc163d163396578155651318ff4016b1"
},
"downloads": -1,
"filename": "django_import_export_extensions-1.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7303594839dca026610090404914a77c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 72854,
"upload_time": "2025-01-28T04:23:26",
"upload_time_iso_8601": "2025-01-28T04:23:26.758943Z",
"url": "https://files.pythonhosted.org/packages/72/c2/30f513dddac277f6e154f926a9e29c214aff8b52bb9276b0dae022583c53/django_import_export_extensions-1.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "d63cbb0c117844150cfa5b2d22ec8850a60072ad5b286a701d3a3ced2f34944c",
"md5": "2498665cb81d96b892f3732604ef283f",
"sha256": "cd71af9eb5a1d05038fc0c59352b50d87b02510b4cad6036873d82fabd5550a6"
},
"downloads": -1,
"filename": "django_import_export_extensions-1.4.0.tar.gz",
"has_sig": false,
"md5_digest": "2498665cb81d96b892f3732604ef283f",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 45895,
"upload_time": "2025-01-28T04:23:28",
"upload_time_iso_8601": "2025-01-28T04:23:28.081527Z",
"url": "https://files.pythonhosted.org/packages/d6/3c/bb0c117844150cfa5b2d22ec8850a60072ad5b286a701d3a3ced2f34944c/django_import_export_extensions-1.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-28 04:23:28",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "saritasa-nest",
"github_project": "django-import-export-extensions",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "django-import-export-extensions"
}