Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/saritasa-nest/django-import-export-extensions
django-import-export-extensions
https://github.com/saritasa-nest/django-import-export-extensions
celery csv django django-import-export import-export json python xlsx
Last synced: 8 days ago
JSON representation
django-import-export-extensions
- Host: GitHub
- URL: https://github.com/saritasa-nest/django-import-export-extensions
- Owner: saritasa-nest
- License: mit
- Created: 2023-03-31T03:04:27.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-24T07:09:31.000Z (21 days ago)
- Last Synced: 2024-10-25T02:23:24.552Z (20 days ago)
- Topics: celery, csv, django, django-import-export, import-export, json, python, xlsx
- Language: Python
- Homepage: https://django-import-export-extensions.readthedocs.io/
- Size: 1.01 MB
- Stars: 46
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- Changelog: HISTORY.rst
- Contributing: CONTRIBUTING.rst
- License: LICENSE
- Codeowners: .github/CODEOWNERS
- Authors: AUTHORS.rst
Awesome Lists containing this project
README
===============================
django-import-export-extensions
===============================.. image:: https://github.com/saritasa-nest/django-import-export-extensions/actions/workflows/checks.yml/badge.svg
:target: https://github.com/saritasa-nest/django-import-export-extensions/actions/workflows/checks.yml
:alt: Build status on Github.. image:: https://coveralls.io/repos/github/saritasa-nest/django-import-export-extensions/badge.svg?branch=main
:target: https://coveralls.io/github/saritasa-nest/django-import-export-extensions?branch=main
:alt: Test coverage.. image:: https://img.shields.io/pypi/pyversions/django-import-export-extensions
:target: https://pypi.org/project/django-import-export-extensions/
:alt: Supported python versions.. image:: https://img.shields.io/badge/django--versions-4.0_%7C_4.1_%7C_4.2_%7C_5.0-blue
:target: https://pypi.org/project/django-import-export-extensions/
:alt: Supported django versions.. image:: https://readthedocs.org/projects/django-import-export-extensions/badge/?version=latest
:target: https://django-import-export-extensions.readthedocs.io/en/latest/?badge=latest
:alt: Documentation Status.. image:: https://static.pepy.tech/personalized-badge/django-import-export-extensions?period=month&units=international_system&left_color=gray&right_color=blue&left_text=Downloads/month
:target: https://pepy.tech/project/django-import-export-extensions
:alt: Downloading statisticDescription
-----------
``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:
.. code-block:: console
$ pip install django-import-export-extensions
Add ``import_export`` and ``import_export_extensions`` to ``INSTALLED_APPS``
.. code-block:: 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... code-block:: shell
$ python manage.py migrate
$ python manage.py collectstaticUsage
-----Prepare resource for your model
.. code-block:: python
# apps/books/resources.py
from import_export_extensions.resources import CeleryModelResourcefrom .. import models
class BookResource(CeleryModelResource):
class Meta:
model = models.BookUse ``CeleryImportExportMixin`` class and set ``resource_class`` in admin model
to import/export via Django Admin.. code-block:: python
# apps/books/admin.py
from django.contrib import adminfrom import_export_extensions.admin import CeleryImportExportMixin
from .. import resources
@admin.register(models.Book)
class BookAdmin(CeleryImportExportMixin, admin.ModelAdmin):
resource_class = resources.BookResourcePrepare view sets to import/export via API
.. code-block:: python
# apps/books/api/views.py
from .. import resourcesfrom import_export_extensions.api import views
class BookExportViewSet(views.ExportJobViewSet):
resource_class = resources.BookResourceclass BookImportViewSet(views.ImportJobViewSet):
resource_class = resources.BookResourceDon't forget to `configure Celery `_
if you want to run import/export in backgroundLinks:
------
* 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/License:
--------
* Free software: MIT license