Skip to main content

Helper class for generate sample data

Project description

Sample Data

https://travis-ci.org/jespino/sampledata.png?branch=master https://coveralls.io/repos/jespino/sampledata/badge.png?branch=master https://pypip.in/v/sampledata/badge.png https://pypip.in/d/sampledata/badge.png

App to automatically populate django database.

Install

Install using pip, including any pillow if you want image genetion…:

pip install sampledata
pip install pillow  # For image generation

Quick start

You can build any kind of object using the SampleData class.

from sampledata.helper import SampleData

def generate_random_users(instances):
    sd = SampleData(seed=123)

    users = []
    for x in range(instances):
        data = {
            "slug": sd.slug(2, 3),
            "name": sd.name('us'),
            "claim": sd.sentence(),
            "description": sd.paragraph(),
            "email": sd.email(),
            "photo": sd.image_stream(64, 64),
            "is_active": sd.boolean(),
            "birth_date": sd.past_date(),
            "expected_death_date": sd.future_date(),
        }
        users.append(data)
    return users

Documentation

Read the Docs: https://sampledata.readthedocs.org/en/latest/

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

sampledata-0.3.1.tar.gz (175.9 kB view details)

Uploaded Source

File details

Details for the file sampledata-0.3.1.tar.gz.

File metadata

  • Download URL: sampledata-0.3.1.tar.gz
  • Upload date:
  • Size: 175.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for sampledata-0.3.1.tar.gz
Algorithm Hash digest
SHA256 2c6c9f4bcaa93013cf0c5f5f125fdc7ec3dbeaab2d8064ae4eda42472a7f23fd
MD5 201d9583b631b475599021c0ac5dde86
BLAKE2b-256 3145e2a94ab98a90048362dc8e249ec6e9b439edd8e67e2dc9bd49020f60acd8

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