{ "info": { "author": "Alex Hayes", "author_email": "alex@alution.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Django", "Framework :: Django :: 1.7", "Framework :: Django :: 1.8", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: MacOS :: MacOS X", "Operating System :: Microsoft :: Windows", "Operating System :: OS Independent", "Operating System :: POSIX", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: Implementation :: CPython", "Topic :: Database", "Topic :: Software Development :: Code Generators" ], "description": "django-migration-fixture\n========================\n\nEasily use fixtures in Django 1.7+ data migrations.\n\nThe app also contains a management command to automatically convert \n:code:`initial_data.*` into migrations.\n\nPrior to Django 1.7 :code:`initial_data.*` files where automatically run when the \nmanagement command :code:`sync_db` was run, however this behaviour was \ndiscontinued in Django 1.7. Thus, this app is useful if you rely on this \nbehaviour.\n\nEssentially it leaves the :code:`initial_data.*` file in place and generates a \ndata migration - as outlined \n`in the docs `_.\n\nInstall\n-------\n\n.. code-block:: python\n\n\tpip install django-migration-fixture\n\nThen add :code:`django_migration_fixture` to your :code:`INSTALLED_APPS`.\n\n.. code-block:: python\n\n\tINSTALLED_APPS += (\n\t\t'django_migration_fixture',\n\t)\n\nUsage\n-----\n\nTo automatically change your old-skool :code:`initial_data.*` files the simplest \nmethod is to simply call the :code:`create_initial_data_fixtures` management \ncommand.\n\n.. code-block:: bash\n\n\t./manage.py create_initial_data_fixtures\n\nThe management command will automatically look for :code:`initial_data.*` files \nin your list of :code:`INSTALLED_APPS` and for each file found creates a data \nmigration, similar to the following; \n\n.. code-block:: python\n\n\t# -*- coding: utf-8 -*-\n\tfrom __future__ import unicode_literals\n\tfrom django.db import models, migrations\n\tfrom django_migration_fixture import fixture\n\timport myapp\n\t\n\tclass Migration(migrations.Migration):\n\t\n\t\toperations = [\n\t\t\tmigrations.RunPython(**fixture(myapp, 'initial_data.yaml'))\n\t\t]\n\nFrom this point it's just a matter of running `migrate` to apply your data \nmigrations.\n\nNote that this solution also supports rolling back your migration by deleting \nusing primary key. If your migration should not be reversible then you can pass \n`reversible=False` to `fixture()`.\n\nYou can use this app for any fixtures, they don't have to be your initial_data \nfiles. Simply create a empty migration and add a call to \n:code:`migrations.RunPython(**fixture(myapp, 'foo.yaml'))`.\n\nAPI Documentation\n-----------------\n\n:code:`fixture(app, fixtures, fixtures_dir='fixtures', raise_does_not_exist=False, reversible=True)`\n\n- *app* is a Django app that contains your fixtures\n- *fixtures* can take either a string or a list of fixture files. The extension \n is used as the format supplied to :code:`django.core.serializers.deserialize`\n- *fixtures_dir* is the directory inside your app that contains the fixtures\n- *ignore_does_not_exist* - if set to True then \n :code:`django_migration_fixture.FixtureObjectDoesNotExist` is raised if when \n attempting a rollback the object in the fixture does not exist.\n- *reversible* - if set to :code:`False` then any attempt to reverse the \n migration will raise :code:`django.db.migrations.migration.IrreversibleError`.\n\nEssentially :code:`fixture()` returns a dict containing the keys :code:`code` \nand :code:`reverse_code` which attempt to apply your fixture and rollback your \nfixture, respectively.\n\nInspiration\n-----------\n\nWhile attempting to migrate a large Django project to 1.7 I came across an issue \nwhich caused me to create Django `ticket 24023 `_. \n\nThe project has a lot of fixtures that ensure a baseline state and converting \nthem to code isn't really ideal, thus this project.\n\nThat issue has since been closed as a duplicate of \n`ticket 23699 `_ which itself has \nbeen closed and released in Django 1.7.2.\n\nNeedless to say, you may still need to create data migrations for fixtures \nregardless of the issue I came across.\n\nAuthor\n------\n\nAlex Hayes ", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/alexhayes/django-migration-fixture", "keywords": "django,migrations,initial data,fixtures", "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-migration-fixture", "package_url": "https://pypi.org/project/django-migration-fixture/", "platform": "any", "project_url": "https://pypi.org/project/django-migration-fixture/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/alexhayes/django-migration-fixture" }, "release_url": "https://pypi.org/project/django-migration-fixture/0.5.1/", "requires_dist": null, "requires_python": null, "summary": "Easily use fixtures in Django 1.7+ data migrations.", "version": "0.5.1" }, "last_serial": 1647524, "releases": { "0.1.3": [ { "comment_text": "", "digests": { "md5": "ba88adaef93e2c477780506718b2aa70", "sha256": "2f9df7e97b71863813456422e8762fba8f410de909388041fb8cf913d75b9294" }, "downloads": -1, "filename": "django-migration-fixture-0.1.3.tar.gz", "has_sig": false, "md5_digest": "ba88adaef93e2c477780506718b2aa70", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3372, "upload_time": "2015-01-06T21:04:17", "url": "https://files.pythonhosted.org/packages/c1/30/d2cad47b6cdb16893af4ea8188d74a70e76dbb6470a8edd21e6b1e36b2f5/django-migration-fixture-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "", "digests": { "md5": "0fe790c14f2d5b86f84b412d39f05af7", "sha256": "3cb224dc5488d51d740cfd89aca86c2ae4cb934b0ac26b4f1da644fe5bf907fe" }, "downloads": -1, "filename": "django-migration-fixture-0.1.4.tar.gz", "has_sig": false, "md5_digest": "0fe790c14f2d5b86f84b412d39f05af7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5225, "upload_time": "2015-01-06T21:14:51", "url": "https://files.pythonhosted.org/packages/e9/9e/532dd4b2c5699300890586fce808f0dc08943c2733a2813497b1fa408a66/django-migration-fixture-0.1.4.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "9a28b78b831fe00b732e5ef29ed347c8", "sha256": "b5ade63963ac4a293ca537077c63f12c40b3756c27d84f411f0178d572329d0a" }, "downloads": -1, "filename": "django-migration-fixture-0.2.0.tar.gz", "has_sig": false, "md5_digest": "9a28b78b831fe00b732e5ef29ed347c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5262, "upload_time": "2015-07-16T03:40:55", "url": "https://files.pythonhosted.org/packages/0b/9d/34cc837c13cdb08018d3cec1d36ed4b2365883d6eabe08598e785788c146/django-migration-fixture-0.2.0.tar.gz" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "688db8a6a94a95977fc45887a81ba721", "sha256": "90cec61bcd8707b6de67c2cefac9291a41cd1b09f46f40fe3b55bca962a9efcf" }, "downloads": -1, "filename": "django-migration-fixture-0.4.0.tar.gz", "has_sig": false, "md5_digest": "688db8a6a94a95977fc45887a81ba721", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5523, "upload_time": "2015-07-16T04:02:18", "url": "https://files.pythonhosted.org/packages/0a/86/a73bb6645f0fa5e75212438665354ed7e70f2d0db4b46ac963b30f3bf715/django-migration-fixture-0.4.0.tar.gz" } ], "0.5.0": [], "0.5.1": [ { "comment_text": "", "digests": { "md5": "d8ff578f7cdc39a3655730277468798a", "sha256": "39ae9f3a387a203f3c1400c9f65edf00fd3a276e844f63f4b1bc26e8b847d92d" }, "downloads": -1, "filename": "django-migration-fixture-0.5.1.tar.gz", "has_sig": false, "md5_digest": "d8ff578f7cdc39a3655730277468798a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7614, "upload_time": "2015-07-24T02:12:10", "url": "https://files.pythonhosted.org/packages/88/c4/eb98ef136b05dc32923334d7fb432879b4c447096c5fa7b208ab01629f20/django-migration-fixture-0.5.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d8ff578f7cdc39a3655730277468798a", "sha256": "39ae9f3a387a203f3c1400c9f65edf00fd3a276e844f63f4b1bc26e8b847d92d" }, "downloads": -1, "filename": "django-migration-fixture-0.5.1.tar.gz", "has_sig": false, "md5_digest": "d8ff578f7cdc39a3655730277468798a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7614, "upload_time": "2015-07-24T02:12:10", "url": "https://files.pythonhosted.org/packages/88/c4/eb98ef136b05dc32923334d7fb432879b4c447096c5fa7b208ab01629f20/django-migration-fixture-0.5.1.tar.gz" } ] }