{ "info": { "author": "SolarLiner", "author_email": "solarliner@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Framework :: Django", "Intended Audience :: Information Technology", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 3", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Testing", "Topic :: Software Development :: Widget Sets", "Topic :: Utilities" ], "description": "Django Populate\n===============\n\n*Django Populate* uses the `faker`_ package to generate test data for Django models and templates.\n\n|pypi| |pipeline| |coverage| |windows_build| |downloads| |license|\n\nHow to use\n----------\n\nTo install Django Populate you can use pip::\n\n pip install django-populate\n\n\nConfiguration\n~~~~~~~~~~~~~\n\nIn django application `settings.py`::\n\n INSTALLED_APPS = (\n\n # ...\n 'django_populate',\n )\n\n FAKER_LOCALE = None # settings.LANGUAGE_CODE is loaded\n FAKER_PROVIDERS = None # faker.DEFAULT_PROVIDERS is loaded (all)\n\n\nPopulating Django Models\n~~~~~~~~~~~~~~~~~~~~~~~~\n\n*django-populate* provides an adapter for Django Models, for easy population of test databases.\nTo populate with Model instances, create a new Populator class,\nthen list the class and number of all of Models that must be generated. To launch the actual data population,\ncall `execute()` method.\n\nHere is an example showing how to populate 5 `Game` and 10 `Player` objects::\n\n from django_populate import Faker\n # this Populator is only a function thats return a django_populate.populator.Populator instance\n # correctly initialized with a faker.generator.Generator instance, configured as above\n populator = Faker.getPopulator()\n\n from myapp.models import Game, Player\n populator.addEntity(Game,5)\n populator.addEntity(Player,10)\n\n insertedPks = populator.execute()\n\nThe populator uses name and column type guessers to populate each column with relevant data.\nFor instance, django-populate populates a column named `first_name` using the `firstName` formatter, and a column with\na `datetime` instance using the `dateTime`.\nThe resulting entities are therefore coherent. If django-populate misinterprets a column name, you can still specify a custom\nfunction to be used for populating a particular column, using the third argument to `addEntity()`::\n\n\n populator.addEntity(Player, 10, {\n 'score': lambda x: populator.generator.randomInt(0,1000),\n 'nickname': lambda x: populator.generator.email(),\n })\n populator.execute()\n\nOf course, django-populate does not populate autoincremented primary keys.\nIn addition, `django_populate.populator.Populator.execute()` returns the list of inserted PKs, indexed by class::\n\n print insertedPks\n {\n : [1, 2, 3, 4, 5, 6, 7, 8, 9, 10],\n : [1, 2, 3, 4, 5]\n }\n\nIn the previous example, the `Player` and `Game` models share a relationship. Since `Game` entities are populated first,\nFaker is smart enough to relate the populated `Player` entities to one of populated `Game` entities.\n\n\nTemplate tags and filter\n~~~~~~~~~~~~~~~~~~~~~~~~\n\ndjango-populate offers a useful template tags and filters for interact with `PyFaker`_::\n\n {% fake 'name' as myname %}{% fake 'dateTimeBetween' '-10d' as mydate %}\n\n {{ myname|title }} - {{ mydate|date:\"M Y\" }}\n\n\n\n {% load fakers %}\n\n \n \n {% fake 'randomInt' 10 20 as times %}\n {% for i in 10|get_range %}\n \n \n {% if 'boolean'|fake:25 %}\n \n {% endif %}\n
\n {% fakestr 'streetAddress' %}\n {% fakestr 'city' %}\n {% fakestr 'postcode' %}\n {% fakestr 'state' %}\n
\n \n {% if 'boolean'|fake:25 %}\n {% fakestr 'bs' %}\n {% endif %}\n {% if 'boolean'|fake:33 %}\n \n {% endif %}\n \n {% if 'boolean'|fake:15 %}\n
\n \n
\n {% endif %}\n
\n {% endfor %}\n
\n\n\nPage preview\n~~~~~~~~~~~~\nOpen `url.py` in your main application and add this url::\n\n urlpatterns = patterns('',\n ...\n url(r'', include('django_populate.urls')),\n ...\n )\n\nhttp://127.0.0.1:8000/preview/ shows a faked browser windows, useful for screenshots.\n\nRunning the Tests\n-----------------\n\nRun django tests in a django environment:\n\n $ python runtests.py\n\nor if you have 'django_populate' in INSTALLED_APPS:\n\n $ python manage.py test django_populate\n\n\n`Changelog`_\n---------\nChangelogs have moved to `their own files `_.\n\n.. _faker: https://www.github.com/joke2k/faker/\n\n.. _Changelog: CHANGELOG\n\n.. |pypi| image:: https://img.shields.io/pypi/v/django-populate.svg\n :target: https://pypi.python.org/pypi/django-populate\n :alt: Latest version released on PyPi\n\n.. |pipeline| image:: https://gitlab.com/solarliner/django-populate/badges/develop/pipeline.svg\n\t:target: https://gitlab.com/solarliner/django-populate/commits/develop\n\t:alt: Pipeline status\n\n.. |coverage| image:: ttps://gitlab.com/solarliner/django-populate/badges/develop/coverage.svg\n\t:target: https://gitlab.com/solarliner/django-populate/commits/develop\n\t:alt: Coverage in % of total files\n\n.. |windows_build| image:: https://img.shields.io/appveyor/ci/solarliner/django-populate.svg?label=windows%20build\n :target: https://ci.appveyor.com/project/solarliner/django-populate\n :alt: Build status of the master branch on Windows\n\n.. |downloads| image:: https://img.shields.io/pypi/dm/django-populate.svg\n :target: https://pypi.python.org/pypi/django-populate\n :alt: Monthly downloads\n\n.. |license| image:: https://img.shields.io/badge/license-MIT-blue.svg\n :target: LICENSE.txt\n :alt: Package license\n\n\n", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://gitlab.com/solarliner/django-populate", "keywords": "faker populate database fixtures data test django", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-populate", "package_url": "https://pypi.org/project/django-populate/", "platform": "", "project_url": "https://pypi.org/project/django-populate/", "project_urls": { "Homepage": "https://gitlab.com/solarliner/django-populate" }, "release_url": "https://pypi.org/project/django-populate/0.3.2/", "requires_dist": [ "django (==2.1.7)", "faker (==1.0.2)", "python-dateutil (==2.8.0)", "pytz (==2018.9)", "six (==1.12.0)", "text-unidecode (==1.2)" ], "requires_python": "", "summary": "Django-faker uses python-faker to generate test data for Django models and templates.", "version": "0.3.2" }, "last_serial": 4818159, "releases": { "0.3.0": [ { "comment_text": "", "digests": { "md5": "0aa3f76c22125cf5c83b898a7ade2796", "sha256": "d018a0ce38396dc75946dfa8b6a55f21b90b7c46c009563f9b3562c8b45da463" }, "downloads": -1, "filename": "django_populate-0.3.0-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "0aa3f76c22125cf5c83b898a7ade2796", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 13241, "upload_time": "2019-02-12T11:53:27", "url": "https://files.pythonhosted.org/packages/b9/37/f119b5c050eb07737c029d0f9eec3903236ec8fa02809c1787e019056c03/django_populate-0.3.0-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "5bab9e7ccd635532d8b63bce05061633", "sha256": "f4a6de43c753240e02d66cfd1311e435ee28bdf4a10d730ea802a23b977368a0" }, "downloads": -1, "filename": "django-populate-0.3.0.tar.gz", "has_sig": false, "md5_digest": "5bab9e7ccd635532d8b63bce05061633", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12284, "upload_time": "2019-02-12T11:53:30", "url": "https://files.pythonhosted.org/packages/49/22/2803c11edeeb4ce8af3d67bab5c96f0fa617f0fafc74ff3ad77a9b22f8c1/django-populate-0.3.0.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "162f4b3dc34d5eb2c69a6dc67d6583ab", "sha256": "bf14c042bfbaeca2a2ab27c322e460d78b631fb69c85754e418db893d2f7811a" }, "downloads": -1, "filename": "django_populate-0.3.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "162f4b3dc34d5eb2c69a6dc67d6583ab", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 13248, "upload_time": "2019-02-12T19:13:29", "url": "https://files.pythonhosted.org/packages/b6/e6/d4e16f0506984965ce97e5b78c6fc0bebb219cdb198dded21d82828cb27b/django_populate-0.3.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d6700657ea1a633c3a392f3d63ddad8a", "sha256": "cdea0cf11dd5ee09819d9f32fc09f963bf5efa7c5dd13a6bc3151f0c83c4f1ca" }, "downloads": -1, "filename": "django-populate-0.3.1.tar.gz", "has_sig": false, "md5_digest": "d6700657ea1a633c3a392f3d63ddad8a", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12286, "upload_time": "2019-02-12T19:13:31", "url": "https://files.pythonhosted.org/packages/36/47/986cfd39dc82ec23f2a25ca386c4e0d438579f1dda3c7ddb3cce228838ef/django-populate-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "e5bd7cae53c1f998688207bb1a850555", "sha256": "75665f5252289826a00c63d7ec3a8e68db0ae5c56f334c2a070ff15f823449da" }, "downloads": -1, "filename": "django_populate-0.3.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e5bd7cae53c1f998688207bb1a850555", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 13321, "upload_time": "2019-02-14T00:35:25", "url": "https://files.pythonhosted.org/packages/5a/61/85172c68d428d590292b7a7a92e6c65b6a9d78025a145bf421eb03768ef7/django_populate-0.3.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "16d2b0d8699f5c2581c7b9089e592418", "sha256": "903c88a06046cdad3f4eae0513be2a5301ea5e4114bd66abaaec68309bd44825" }, "downloads": -1, "filename": "django-populate-0.3.2.tar.gz", "has_sig": false, "md5_digest": "16d2b0d8699f5c2581c7b9089e592418", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12361, "upload_time": "2019-02-14T00:35:27", "url": "https://files.pythonhosted.org/packages/e8/ed/17049cda52826f751fc7a9ca6f57b202959ab54f13be0e8ad441fcee90dd/django-populate-0.3.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "e5bd7cae53c1f998688207bb1a850555", "sha256": "75665f5252289826a00c63d7ec3a8e68db0ae5c56f334c2a070ff15f823449da" }, "downloads": -1, "filename": "django_populate-0.3.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "e5bd7cae53c1f998688207bb1a850555", "packagetype": "bdist_wheel", "python_version": "py2.py3", "requires_python": null, "size": 13321, "upload_time": "2019-02-14T00:35:25", "url": "https://files.pythonhosted.org/packages/5a/61/85172c68d428d590292b7a7a92e6c65b6a9d78025a145bf421eb03768ef7/django_populate-0.3.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "16d2b0d8699f5c2581c7b9089e592418", "sha256": "903c88a06046cdad3f4eae0513be2a5301ea5e4114bd66abaaec68309bd44825" }, "downloads": -1, "filename": "django-populate-0.3.2.tar.gz", "has_sig": false, "md5_digest": "16d2b0d8699f5c2581c7b9089e592418", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12361, "upload_time": "2019-02-14T00:35:27", "url": "https://files.pythonhosted.org/packages/e8/ed/17049cda52826f751fc7a9ca6f57b202959ab54f13be0e8ad441fcee90dd/django-populate-0.3.2.tar.gz" } ] }