Skip to main content

Set of tools to extract fixtures from Django models navigating through the relationships of a given model to get a usable subset of the database.

Project description

https://badge.fury.io/py/django-fixtures-extractor.svg https://travis-ci.org/matibarriento/django-fixtures-extractor.svg?branch=master https://codecov.io/gh/matibarriento/django-fixtures-extractor/branch/master/graph/badge.svg

Extract specific data to a django fixture

Documentation

The full documentation is at https://django-fixtures-extractor.readthedocs.io.

Quickstart

Install Django Fixtures Extractor:

pip install django-fixtures-extractor

Add it to your INSTALLED_APPS:

INSTALLED_APPS = (
    ...
    'fixtures_extractor',
    ...
)

TODO Features

  • Add feature: Support config params

  • Add feature: Obfuscate value

Desired features

  • Add supported model fields
  • Add feature: Generate schema from model

Running Tests

Does the code actually work?

source <YOURVIRTUALENV>/bin/activate
(myenv) $ python runtests.py

Development commands

pip install -r requirements/requirements_dev.txt

How to add a new app and add tests

  1. Create the app

$ cd tests/testproject
$ python ../../manage.py startapp {APP_NAME}
  1. Change the {APP_NAME}Config.name inside the tests/{APP_NAME}/apps.py file for tests.testproject.{APP_NAME}.apps.{APP_NAME}

  2. Add the app to the INSTALLED_APPS in the /testproject/testproject/settings.py file

  3. Write the models that you would use to test on the model folder inside your app

  4. Create the migrations using python manage.py makemigrations {APP_NAME}

  5. Run the migrations using python manage.py migrate

  6. Create the tests inside the tests/tests_orm_extractor.py file

Credits

Based on https://github.com/ascaliaio/django-dumpdata-one

Tools used in rendering this package:

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_fixtures_extractor-0.1.3.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_fixtures_extractor-0.1.3-py2.py3-none-any.whl (9.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django_fixtures_extractor-0.1.3.tar.gz.

File metadata

File hashes

Hashes for django_fixtures_extractor-0.1.3.tar.gz
Algorithm Hash digest
SHA256 55743a71c772a7b890814922405150e7215d867db0be5b9824ba00278b85f5a1
MD5 9857b82c9cccc30e6c38592b6062d5c6
BLAKE2b-256 d23076136190367ca0a084cff38f4c791b2431b940146156e03d5dfb0312ba98

See more details on using hashes here.

File details

Details for the file django_fixtures_extractor-0.1.3-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_fixtures_extractor-0.1.3-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 35ecdc184d6fc388063297a8394598de159b3fbbe2685fbcc945218918805abb
MD5 7f32ade1250c3853820e82b7b0429c93
BLAKE2b-256 9b81c0330893adb75f97bde09f74d909cd34f8c5f95ef104b062500609e8af01

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page