{ "info": { "author": "Dave Dash", "author_email": "dd+pypi@davedash.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.10", "Framework :: Django :: 1.11", "Framework :: Django :: 1.8", "Framework :: Django :: 1.9", "Framework :: Django :: 2.0", "Framework :: Django :: 2.1", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python :: 2", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": ".. image:: https://travis-ci.org/davedash/django-fixture-magic.png?branch=master\n :target: https://travis-ci.org/davedash/django-fixture-magic\n\n\n\n============\nRequirements\n============\n\nThis package requires:\n\n* Python 2.7, 3.6\n* Django 1.8 - 2.1\n\n\nInstallation\n------------\n\nYou can get fixture-magic from pypi with::\n\n pip install django-fixture-magic\n\nThe development version can be installed with::\n\n pip install -e git://github.com/davedash/django-fixture-magic#egg=fixture-magic\n\nFor use in python3 install the following::\n\n pip install future\n\nfixture-magic adds two commands to ``manage.py`` therefore you should add it to\nyour ``INSTALLED_APPS`` in ``settings.py``:\n\n.. code-block:: python\n\n INSTALLED_APPS = (\n ...\n 'fixture_magic',\n ...\n )\n\nUsage\n-----\n\nThere are four commands. ``dump_object`` returns the json representation of\na specific object as well as all its dependencies (as defined by ForeignKeys)::\n\n ./manage.py dump_object APP.MODEL PK1 PK2 PK3 ... > my_new_fixture.json\nOr:\n\n::\n\n ./manage.py dump_object APP.MODEL --query '{\"pk__in\": [PK1, PK2, PK3]}' > my_new_fixture.json\n\nOr you can get all objects with all dependencies by passing an asterisk::\n\n ./manage.py dump_object APP.MODEL '*' > my_new_fixture.json\n\nYou can now safely load ``my_new_fixture.json`` in a test without foreign key i\nerrors.\n\nBy default, fixture magic will dump related fixtures to your model in your fixture.\nThis can be disabled by passing the option ``--no-follow`` to ``dump_object``. This\nis useful if your target database is already partially setup. Here is and example default output of dump_object::\n\n ./manage.py dump_object APP.Book\n\n.. code-block:: json\n\n [\n {\n \"model\": \"APP.Author\",\n \"fields\": {\n \"pk\": 5,\n \"name\": \"Mark Twain\",\n }\n },\n {\n \"model\": \"APP.Book\",\n \"fields\": {\n \"pk\": 2,\n \"title\": \"Tom Sawyer\",\n \"author\": 5\n }\n }\n ]\n\nRunning with the ``--no-follow`` options yields:\n\n ./manage.py dump_object APP.Book --no-follow\n\n.. code-block:: json\n\n [\n {\n \"model\": \"APP.Book\",\n \"fields\": {\n \"pk\": 2,\n \"title\": \"Tom Sawyer\",\n \"author\": 5\n }\n }\n ]\n\n\n:Note: The above example assumes that an Author with an ID of 5 exists in the target database.\n\nThe second command is ``merge_fixtures``. This command takes several fixture\nfiles and does a simple de-dupe operation (based on model and pk) and returns a\nclean json file. This is helpful if you have multiple json fixtures that might\nhave redundant data::\n\n ./manage.py merge_fixtures fixture1.json fixture2.json fixture3.json ... \\\n > all_my_fixtures.json\n\nThe third command is ``reorder_fixtures``. This command takes a single file\nand several model names (in ``app.model`` format as they are specified in\nfixture files). This reorders your fixtures so the models you specifiy first\nshow up in the fixture first. This is helpful if you tend to get foreign-key\nerrors when loading models::\n\n ./manage.py reorder_fixtures fixture.json APP1.MODEL1 APP2.MODEL2 ... \\\n > ordered_fixture.json\n\nUnspecified models will be appended to the end.\n\nThe fourth command is ``custom_dump``. This reads a setting ``CUSTOM_DUMPS``:\n\n.. code-block:: python\n\n ## Fixture Magic\n CUSTOM_DUMPS = {\n 'addon': { # Initiate dump with: ./manage.py custom_dump addon id\n 'primary': 'addons.addon', # This is our reference model.\n 'dependents': [ # These are the attributes/methods of the model that we wish to dump.\n 'current_version',\n 'current_version.files.all.0',\n ],\n 'order': ('app1.model1', 'app2.model2',),\n 'order_cond': {'app1.model1': lambda x: 1 if x.get('fields').get('parent_model1') else 0,\n 'app2.model2': lambda x: -1 * x.get('pk')},\n }\n }\n\nIt runs the equivalent of ``dump_object`` on the dependents (which in turn pick\nup the primary object). The JSON dumps are then merged together. Very handy\nfor dumping multi-dependent objects. `dependents`, `order` and `order_cond` are\noptional.\n\n``dependents``: Defines additional properties/methods to dump the return values\nof. Magic will convert `\"current_version.files.all.0\"`\nto `object.current_version.files.all()[0]`\n\n``order``: Specify an order in which objects should be dumped based on their\nmodel class. In the above example, all app1.model1 objects will preceed any\napp2.model2 objects, which will preceed any objects of any other model class.\n\n``order_cond``: Specify an order to dump objects of one or more particular model\nclasses. In the above example, all app1.model1 objects with a truthy\n`self.parent_model1` attribute will come after any other app1.model1 object that\ndoes not have a truthy value for this attribute. A sort operation is called on\nthe list of all objects of that model type, with the value associated with a\nmodel name being passed to the sort function as the `key` keyword argument.\nKeep in mind that the model objects will have already been serialized to a\ndictionary object prior to the sort operation.\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/davedash/django-fixture-magic", "keywords": "", "license": "BSD", "maintainer": "", "maintainer_email": "", "name": "django-fixture-magic", "package_url": "https://pypi.org/project/django-fixture-magic/", "platform": "", "project_url": "https://pypi.org/project/django-fixture-magic/", "project_urls": { "Homepage": "http://github.com/davedash/django-fixture-magic" }, "release_url": "https://pypi.org/project/django-fixture-magic/0.1.4/", "requires_dist": null, "requires_python": "", "summary": "A few extra management tools to handle fixtures.", "version": "0.1.4" }, "last_serial": 4395188, "releases": { "0.0.1": [], "0.0.2": [ { "comment_text": "built for Darwin-10.3.0", "digests": { "md5": "c6945011d91504b303ef8180993aafaf", "sha256": "0bc9babe4fc97a1373329b25409ed14aa4a52980928d97b31b600fd1aabd529b" }, "downloads": -1, "filename": "django-fixture-magic-0.0.2.macosx-10.6-i386.tar.gz", "has_sig": false, "md5_digest": "c6945011d91504b303ef8180993aafaf", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 7275, "upload_time": "2010-05-18T22:25:07", "url": "https://files.pythonhosted.org/packages/11/8e/6b2b4cdd3a867693745f7bae8a7afcb65d9d562e3012e7f27c8656b2256a/django-fixture-magic-0.0.2.macosx-10.6-i386.tar.gz" }, { "comment_text": "", "digests": { "md5": "7273966761a65073b7702dc81198032f", "sha256": "1c5c0b1c3026b8037912364fc26ec44f0455484afb58ff4a9fd39b3f98841a09" }, "downloads": -1, "filename": "django-fixture-magic-0.0.2.tar.gz", "has_sig": false, "md5_digest": "7273966761a65073b7702dc81198032f", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5274, "upload_time": "2010-05-18T22:36:07", "url": "https://files.pythonhosted.org/packages/07/7f/e08d019921e2cc59be0714fb5ba4707bc92a33d540929ef085163140961c/django-fixture-magic-0.0.2.tar.gz" } ], "0.0.3": [ { "comment_text": "", "digests": { "md5": "91a4ba4f95d1a5335e7c5e3cc136416e", "sha256": "1cd4ce6e5639b0f4a02f22ace6e8a5a942c9b5e1079126264ea34c01460cce1a" }, "downloads": -1, "filename": "django-fixture-magic-0.0.3.tar.gz", "has_sig": false, "md5_digest": "91a4ba4f95d1a5335e7c5e3cc136416e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6276, "upload_time": "2011-12-05T22:05:02", "url": "https://files.pythonhosted.org/packages/a8/27/b6f9e59539a6902f837ab41209369aa4bf2192d28ca929d4238fa0fa371d/django-fixture-magic-0.0.3.tar.gz" } ], "0.0.4": [ { "comment_text": "", "digests": { "md5": "b5bd80ae06fcf9be89062a84a9ed2b54", "sha256": "33bffe85f63cb55aa1f31696003a9e5055aa280019651455a4fcdec0842a9acc" }, "downloads": -1, "filename": "django-fixture-magic-0.0.4.tar.gz", "has_sig": false, "md5_digest": "b5bd80ae06fcf9be89062a84a9ed2b54", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6392, "upload_time": "2013-05-08T16:12:23", "url": "https://files.pythonhosted.org/packages/a4/e0/00df38bc2335fe51e8a01c5e1138fd54355e77138a2b990ed0ad5f9d5bcb/django-fixture-magic-0.0.4.tar.gz" } ], "0.0.5": [ { "comment_text": "", "digests": { "md5": "23ed02c964513d2a6fe5235ca49d8855", "sha256": "0e4a5ca063daf578d45ee93f80064d4806e2fd39e717d432c20bd534a9c0c670" }, "downloads": -1, "filename": "django-fixture-magic-0.0.5.tar.gz", "has_sig": false, "md5_digest": "23ed02c964513d2a6fe5235ca49d8855", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7208, "upload_time": "2015-03-24T15:59:03", "url": "https://files.pythonhosted.org/packages/b0/8e/0a3cd1e0a5c9659f916e9fb9ff6e47b3f8521315fdab5f18ffcbbfeb9fc5/django-fixture-magic-0.0.5.tar.gz" } ], "0.0.7": [ { "comment_text": "", "digests": { "md5": "78d7297052d70119abcbead2b0212aa3", "sha256": "e9ef0c3d38f2b984b94c4da8c40000027f5a563834945559bd0cfeb1c64b2f84" }, "downloads": -1, "filename": "django-fixture-magic-0.0.7.tar.gz", "has_sig": false, "md5_digest": "78d7297052d70119abcbead2b0212aa3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7499, "upload_time": "2015-05-13T04:44:00", "url": "https://files.pythonhosted.org/packages/f2/ca/f43972e283705966f6ee2483e6edb6ceddfc5c7808c24a5390a74701f106/django-fixture-magic-0.0.7.tar.gz" } ], "0.0.8": [ { "comment_text": "", "digests": { "md5": "3f8221699fb812ffc9c8d58e3e227f49", "sha256": "cc9072b4bab7d90f74c7c5f79b9f41936fa33ba1c1995fc369652a9fd164d515" }, "downloads": -1, "filename": "django-fixture-magic-0.0.8.tar.gz", "has_sig": false, "md5_digest": "3f8221699fb812ffc9c8d58e3e227f49", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7604, "upload_time": "2016-02-26T03:39:45", "url": "https://files.pythonhosted.org/packages/6a/ee/ab460e35bb282109c217ed16be3b3a0caa0eb020975faa82b8ee5e3c59ec/django-fixture-magic-0.0.8.tar.gz" } ], "0.1.0": [ { "comment_text": "", "digests": { "md5": "6424b77336b9b6394356c9a28ba771eb", "sha256": "4db293449ca45bfa295b6616ce6ca479848483afad9d32752ada1ccd86ee5cd2" }, "downloads": -1, "filename": "django-fixture-magic-0.1.0.tar.gz", "has_sig": false, "md5_digest": "6424b77336b9b6394356c9a28ba771eb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7680, "upload_time": "2016-08-11T15:51:24", "url": "https://files.pythonhosted.org/packages/60/65/13bb857e1e5f439309aa02abc701735e0819df8923958379b5e66eaefd45/django-fixture-magic-0.1.0.tar.gz" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "1b62a46bb94273ad7506829b394167f2", "sha256": "7f6dde7e14b6a625cc7247eb17df29418e7f85a5bc274cbacf927b52dc7af72d" }, "downloads": -1, "filename": "django-fixture-magic-0.1.1.tar.gz", "has_sig": false, "md5_digest": "1b62a46bb94273ad7506829b394167f2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7725, "upload_time": "2016-08-11T16:14:07", "url": "https://files.pythonhosted.org/packages/2e/46/b7169dff9ccb924a2567bd286c5d2a09df5b251a9c4096f28a6e7c88440f/django-fixture-magic-0.1.1.tar.gz" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "c05de01da5eed3b0bb7f3ab7ff8f7990", "sha256": "19d43f99bff86203dd1205b163f2e1cce28d048ff8e9f384235c2b4a8eac3ed8" }, "downloads": -1, "filename": "django-fixture-magic-0.1.2.tar.gz", "has_sig": false, "md5_digest": "c05de01da5eed3b0bb7f3ab7ff8f7990", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7918, "upload_time": "2016-09-08T16:24:22", "url": "https://files.pythonhosted.org/packages/d0/21/003632e9b1ead572c5452d4dcda58202ced5e92f3f6e9057e01be79c8f48/django-fixture-magic-0.1.2.tar.gz" } ], "0.1.3": [ { "comment_text": "", "digests": { "md5": "c07fc56e294788669c726135a02bd1c3", "sha256": "f6249d85c5691bb8beaa57a41babf023e461adf9ae239cbd6c45888670477c9a" }, "downloads": -1, "filename": "django-fixture-magic-0.1.3.tar.gz", "has_sig": false, "md5_digest": "c07fc56e294788669c726135a02bd1c3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 10636, "upload_time": "2017-02-09T18:17:31", "url": "https://files.pythonhosted.org/packages/68/d4/9f77c61103f8df944b48c5f07f85994a674413f3c5a25bc6d9a7896bca23/django-fixture-magic-0.1.3.tar.gz" } ], "0.1.4": [ { "comment_text": "built for Darwin-17.7.0", "digests": { "md5": "1b512148728720cacb437ae4c19020ae", "sha256": "378207fc88a23c43222e73e665d2cadf194b729c6747b463500dc8a3f5940a0b" }, "downloads": -1, "filename": "django-fixture-magic-0.1.4.macosx-10.13-x86_64.tar.gz", "has_sig": false, "md5_digest": "1b512148728720cacb437ae4c19020ae", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 13511, "upload_time": "2018-10-19T18:12:06", "url": "https://files.pythonhosted.org/packages/22/27/131f9e70498f5ad45f9a57e499d352fbc513f6e2e7f3f41493def5ea47e3/django-fixture-magic-0.1.4.macosx-10.13-x86_64.tar.gz" } ] }, "urls": [ { "comment_text": "built for Darwin-17.7.0", "digests": { "md5": "1b512148728720cacb437ae4c19020ae", "sha256": "378207fc88a23c43222e73e665d2cadf194b729c6747b463500dc8a3f5940a0b" }, "downloads": -1, "filename": "django-fixture-magic-0.1.4.macosx-10.13-x86_64.tar.gz", "has_sig": false, "md5_digest": "1b512148728720cacb437ae4c19020ae", "packagetype": "bdist_dumb", "python_version": "any", "requires_python": null, "size": 13511, "upload_time": "2018-10-19T18:12:06", "url": "https://files.pythonhosted.org/packages/22/27/131f9e70498f5ad45f9a57e499d352fbc513f6e2e7f3f41493def5ea47e3/django-fixture-magic-0.1.4.macosx-10.13-x86_64.tar.gz" } ] }