No project description provided
Project description
Overview
django-export-celery is a Django application that enables long processing exports using celery and django-import-export
Dependencies
Python 3.6+
Packages
Django>=3.1
celery>=5.0.0
django-import-export>=2.2.0
Installation and Configuration
Celery must be setup before starting.
Please refer to Using Celery with Django for more information.
- Install with
pip
pip install django-export-celery
- Add apps to
INSTALLED_APPSto project settings.
# settings.py
INSTALLED_APPS = (
...
'import_export',
'django_export_celery',
)
# Optionally, sending emails is enabled by default on completed export
# Disable it by setting to False
DJANGO_EXPORT_CELERY_ENABLE_EMAIL = False
- Setup
modelandresources
# apps/models.py
from django.db import models
from import_export.resources import ModelResource
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
@staticmethod
def get_export_resources():
return {
'rsc1': ('Question', QuestionResource),
}
class Choice(models.Model):
question = models.ForeignKey(Question, on_delete=models.CASCADE)
choice_text = models.CharField(max_length=200)
votes = models.IntegerField(default=0)
class QuestionResource(ModelResource):
class Meta:
model = Question
- Add
ExportCeleryMixinto admin view inadmin.py
# apps/admin.py
from django.contrib import admin
from .models import Question, Choice
from import_export.admin import ImportExportMixin
from django_export_celery.mixins import ExportCeleryMixin
@admin.register(Question)
class QuestionAdmin(ExportCeleryMixin, admin.ModelAdmin):
list_display = (
'question_text',
'pub_date',
)
# also supports django-import-export admin mixins like so
@admin.register(Choice)
class ChoiceAdmin(ImportExportMixin, ExportCeleryMixin, admin.ModelAdmin):
list_display = (
'question',
'choice_text',
'votes',
)
How to use
- Click
EXPORTbutton in upper right in model view
- Select export
Formatand clickSUBMIT
- Export jobs can be found in the
Export Jobsapp along with job status and file link
Demo App
./project/ contains the necessary files to start a sample project
To get started
cd project
pip install -r requirements.txt
python manage.py migrate
python manage.py createsuperuser
python manage.py runserver 8000
TODO: dummy data setup
TODO: Docker setup
Known Issues
A list of known issues to be patched in the future
- Does not respect ordering when exporting
- File format
odsis not supported
Issue Tracker
If you have any bugs, suggestions, or compliants please report an issue here
References
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django-export-celery-0.3.2.tar.gz.
File metadata
- Download URL: django-export-celery-0.3.2.tar.gz
- Upload date:
- Size: 8.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a82705a100afa1039f423fe5687efb3e9811e879010306071ba1b030ba99826
|
|
| MD5 |
731f2476c1afacee15eb2fdff29ce5ce
|
|
| BLAKE2b-256 |
ac62663d90f28645b4d4b6e2911f5933ddf0e5b354acacbe277ecce09ad8604b
|
File details
Details for the file django_export_celery-0.3.2-py3-none-any.whl.
File metadata
- Download URL: django_export_celery-0.3.2-py3-none-any.whl
- Upload date:
- Size: 12.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.9.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.7.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a3e66836fc9a9cdd726c3b46c081d8388f51e05f43dd7c60995d7797cab20c53
|
|
| MD5 |
a4f350d973a4c620bc269c7dd00d1e05
|
|
| BLAKE2b-256 |
9321dbbab81bca5fe587de241b72f976751cdc020b6e11945e29b142bb98b47d
|