Skip to main content

Plugin to generate the lorem ipsum (fake content) for django model

Project description

https://img.shields.io/badge/license-MIT-blue.svg?maxAge=2592000 https://img.shields.io/pypi/pyversions/Django.svg?maxAge=2592000

Plugin to generate the lorem ipsum for django model

http://i.imgur.com/8vg0KoC.png

Install

Djipsum is available directly from PyPI:

$ pip install djipsum

*). And don’t forget to add djipsum to your INSTALLED_APPS setting (without migrations).

Requirements

  • Django>=1.10.1

  • Faker>=0.7.3

Usage

usage: manage.py djipsum [-h] [-dv]
                         [--app APP] [--model MODEL] [--max MAX]

To generate awesome lorem ipsum for your model class!

optional arguments:
  -h, --help            show this help message and exit
  -dv, --djipsum_version
                        Show djipsum version and exit.
  --app APP             The APP name.
  --model MODEL         The Model Class name.
  --max int(MAX)        Maximum generate lorem ipsum.

Example

# Default 10 objects
$ ./manage.py djipsum --app testapp --model TestField

# Custom Maximum objects
$ ./manage.py djipsum --app testapp --model TestField --max=5

API

The Djipsum Faker Model providing additional library from Faker for more than efficient to use.

1. Basic API

>>> from djipsum.faker import FakerModel
>>> faker = FakerModel(app='app_name', model='ModelName')
>>> faker.fake_email() # From Djipsum
'admin@gmail.com'
>>> faker.fake.email() # From Faker Factory
'smithadrian@hotmail.com'
>>>

2. 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.>
>>>

Supported Fields

Char Types

Integer/Float Types

Relationship Types

Other Types

CharField

IntegerField

ForeignKey

BinaryField

TextField

SmallIntegerField

ManyToManyField

DurationField

EmailField

BigIntegerField

OneToOneField (not yet)

BooleanField

SlugField

DecimalField

OneToManyField (not yet)

NullBooleanField

URLField

PositiveIntegerField

UUIDField

FloatField

GenericIPAddressField

PositiveSmallIntegerField

CommaSeparatedIntegerField

DateTimeField

DateField

TimeField

ImageField

FileField

FilePathField (not yet)

License

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

djipsum-1.1.0.tar.gz (12.8 kB view details)

Uploaded Source

File details

Details for the file djipsum-1.1.0.tar.gz.

File metadata

  • Download URL: djipsum-1.1.0.tar.gz
  • Upload date:
  • Size: 12.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for djipsum-1.1.0.tar.gz
Algorithm Hash digest
SHA256 9527573b9282269a1bbe98da4057c3d158b527b9a96feafe18a8fa4f83c8eaa3
MD5 d3aeac11c2592f3b5b6bebbb1bd7d8e8
BLAKE2b-256 0b3522b72285edb04dc80da12d25d0aecba04ecd0b63d6d0ee7bca0361cf2648

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page