Skip to main content

Django data import management application.

Project description

django-data-import-management

Django data import management application.

Install

pip install django-data-import-management

Usage

pro/settings.py

INSTALLED_APPS = [
    ...
    'django_data_import_management',
    'example_app',
    ...
]

example_app/import_workflow.py

from django_data_import_management.models import DjangoDataImportWorkflow
from django_data_import_management.models import ParsedItem

class ExampleImportWorkflow(DjangoDataImportWorkflow):

    def do_parse(self):
        items = []
        for i in range(10):
            item = ParsedItem()
            info = str(i)
            data = {
                "index": 1,
            }
            item.mark_success(info, data)
            items.append(item)
        return items        # Note: always return the parsed ParsedItems
    
    def do_import(self, import_items):
        for item in import_items:
            item.mark_success()
        return import_items   # Note: always return import_items

example_app/apps.py

class ExampleAppConfig(AppConfig):
    name = 'example_app'

    def ready(self):
        from django_data_import_management.models import register_django_data_import_workflow
        from .import_workflows import ExampleImportWorkflow
        register_django_data_import_workflow("Example Import", ExampleImportWorkflow)

example_app/init.py

default_app_config = "example_app.apps.ExampleAppConfig"

Steps:

  1. Setup dependencies.
  2. Create a new workflow.
  3. Register the workflow when project starts.

Releases

Version Date Changes Memo
v0.1.4 2020/12/02 1. First release.
v0.1.5 2021/03/10 2. Pass datafile instance to workflow.
v0.1.6 2021/03/18 3. Add DjangoSimpleExportedDataImportWorkflow base class.
v0.1.8 2021/04/08 4. Fix string format problem.
5. Fix fk problem.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for django-data-import-management, version 0.1.8
Filename, size File type Python version Upload date Hashes
Filename, size django-data-import-management-0.1.8.tar.gz (14.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page