Skip to main content

Django extension for fixture import and merge

Project description

djfim

Django extension of Fixture Import and Merge

License

Apache License Version 2.0

Usage

manage.py fim /path/to/fixture.json

Config

It's as easy as 1-2-3.

  1. Define a sub-class of djfim.models.FURecord in your application's models.py
from djfim.models import FURecord

class YourAppFixture(FURecord):
    '''sub-class'''
    class Meta:
        abstract = False
  1. Set up correct model name in your project's settings.py
DJFIM = {
    'MODEL': {
        'app_name': 'demoapp',
        'app_label': 'YourAppFixture'
    }
}
  1. Invoke the commands to update database schema
python manage.py makemigrations
python manage.py migrate

Customize

Release number is automatically incremented each time the new fixture data is applied.

The release number increment policy is controlled via RELEASE_INCREMENT_POLICY field. Currently only two options are available: PLUS_ONE and PLUS_TEN.

An example is shown below:

# settings.py
DJFIM = {
    'RELEASE_INCREMENT_POLICY': 'PLUS_TEN',
    # other config items
    # ...
}

TODO

  • add unittest
  • add support for user defined release number provider (or increment policy)
  • drop support for Django 1.x and 2.x

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

djfim-0.2.0.tar.gz (11.3 kB view hashes)

Uploaded source

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