No project description provided
Reason this release was yanked:
broken
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
django-author>=1.0.2
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_APPS
andMIDDLEWARE
to project settings.
# settings.py
INSTALLED_APPS = (
...
'import_export',
'author',
'django_export_celery',
)
MIDDLEWARE = (
...
'author.middlewares.AuthorDefaultBackendMiddleware',
)
# Optionally, you can overwrite the default file upload location
# Defaults to 'django-export-celery-jobs/' if not set
DJANGO_EXPORT_CELERY_UPLOAD_TO = 'uploads/'
# Optionally, sending emails can be enabled in form
# Defaults to False if not set
DJANGO_EXPORT_CELERY_ENABLE_EMAIL = True
- Setup
model
andresources
# 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
ExportCeleryMixin
to 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
EXPORT
button in upper right in model view
- Select export
Format
and clickSUBMIT
- Export jobs can be found in the
Export Jobs
app 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
ods
is 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
Close
Hashes for django-export-celery-0.2.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a9a8280ad94f8810ae0505a630973f530b758b835f1f3529872b950b1569bd4f |
|
MD5 | 0972150d5d6ca3048b5d873d3b9f3adc |
|
BLAKE2b-256 | 7ba0522c0d0b156a5568aace78cf409d66058ed8e07060532db07f307aefce79 |
Close
Hashes for django_export_celery-0.2.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09d42bf16163a7c5678819f63bfe80df128eb4ea69cbbb2539f3c9bc98042241 |
|
MD5 | b4f271a5754a3c85b69c06719bb629ba |
|
BLAKE2b-256 | 1e5d1a9237b8eddad6df2712d12410521f2665a81ac9d9be5d9c28ea74acecfc |