easy to create a django fixture
Project description
for python2.7, python3.5 and Django>=1.8
Create a fixture dict that just include some fields you concern, and we will help you to fill your fixture dict with some spam datas that make your fixture dict to be a completely available django fixture that you do not have to worry about any unqiue, unqie_together
install: pip install django-easy-fixture
1. output a fixture dict
pk must be set by yourself
in template.py
fixtures_template={'auth.User': [{'pk': 1}]}
then
from easy_fixture.easy_fixture import EasyFixture
from template import fixtures_template
ef = EasyFixture(fixtures_template)
fixtures_dict = ef.output()
2. use as a django app command
2.1. create a simple fixture template
in template.py
pk must be set by yourself
fixtures_template={'auth.User': [{'pk': 1}]}
2.2. in settings.py
INSTALLED_APPS = ('other apps',
'easy_fixture',
)
2.3. run command
python manage.py make_fixture template > /path/to/fixture.json
3. use in test
from easy_fixture.easy_fixture import FixtureFileGen
class MyCase(TestCase):
fixtures = FixtureFileGen(['my.fixture.template.module'])
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-easy-fixture-0.2.1.tar.gz
(13.7 kB
view hashes)
Built Distribution
Close
Hashes for django-easy-fixture-0.2.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | c291fdd8252ee321370cab4a646c4253376d27ffb1b30a51ba42b43094645e7b |
|
MD5 | b73c77eed0caaf5b41589be3134c6449 |
|
BLAKE2b-256 | eb36dc2fec529b71031a9603341d91d0ba3177fab225396ee07b2a0d4199b9e6 |
Close
Hashes for django_easy_fixture-0.2.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 465df3395372da8a150516ec610cda338e0aa5b71cf26f1f1e7b7af61b027c2e |
|
MD5 | ac288f9980f5fcbb7391fa2d15868d2e |
|
BLAKE2b-256 | f6ab5de95954f27fe287e5510c42dfb876dabd99657f5a258a394f12a30c1e6f |