Djipsum already in new version 1.0.9. Djipsum is awesome command plugin to generate fake content for Django.
What news?
- Fixed
ManyToManyField
(return the random objects from many to many field). - Fixed
ForeignKey
Field (return the random object from foreign field).
Install:
$ pip install djipsum
I never test this tool with Django<=1.9.9
, but i think it should be work well.. you can try with this to ignoring the requirment:
$ pip install djipsum --no-dependencies
Usage Example:
$ ./manage.py djipsum --app yourapp --model ModelName --max=5
Updated release v1.1.0
2 days ago i released v1.0.9, this day we added a new feature Faker Model, this Djipsum Faker Model providing additional library from Faker for more than efficient to use.
Basic API
>>> from djipsum.faker import FakerModel
>>> faker = FakerModel(app='app_name', model='ModelName')
>>> faker.fake_email() # From Djipsum
'[email protected]'
>>> faker.fake.email() # From Faker Factory
'[email protected]'
>>>
Example API Usage
>>> from djipsum.faker import FakerModel
>>> faker = FakerModel(app='app_blog', model='Post')
>>> for _ in range(2):
... fields = {
... 'user': faker.fake_relations(
... type='fk',
... field_name='user'
... ),
... 'title': faker.fake.text(max_nb_chars=100),
... 'slug': faker.fake.slug(
... faker.fake.text(max_nb_chars=50)
... ),
... 'categories': faker.fake_relations(
... type='m2m',
... field_name='categories'
... ),
... 'description': ' '.join(faker.fake.paragraphs()),
... 'created': str(faker.fake.date_time()),
... 'publish': faker.fake_boolean(),
... }
... faker.create(fields)
...
<Post: Sit sunt nam aperiam ratione consequatur. Animi cupiditate atque totam.>
<Post: Tempora porro sint quasi nisi totam doloremque repellat. Ducimus nesciunt impedit animi.>
>>>
For more info, let’s check it out: https://github.com/agusmakmun/djipsum