Skip to main content

Helper class for generate sample data

Project description

Sample Data

App to automatically populate django database.


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),
            "claim": sd.sentence(),
            "description": sd.paragraph(),
            "photo": sd.image_stream(64, 64),
            "is_active": sd.boolean(),
            "birth_date": sd.past_date(),
            "expected_death_date": sd.future_date(),
    return users


Read the Docs:

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for sampledata, version 0.3.3
Filename, size File type Python version Upload date Hashes
Filename, size sampledata-0.3.3.tar.gz (176.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page