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

v0.1.9

  • Fix dependence package version problem.

v0.1.8

  • Fix string format problem.
  • Fix fk problem.

v0.1.6

  • Add DjangoSimpleExportedDataImportWorkflow base class.

v0.1.5

  • Pass datafile instance to workflow.

v0.1.4

  • First release.

Project details


Download files

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

Source Distribution

django-data-import-management-0.1.9.tar.gz (14.1 kB view hashes)

Uploaded source

Built Distribution

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