Helper class for generate sample data
Project description
Sample Data
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(2, 3),
"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(instance)
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.tar.gz
(176.0 kB
view details)
File details
Details for the file sampledata-0.3.tar.gz.
File metadata
- Download URL: sampledata-0.3.tar.gz
- Upload date:
- Size: 176.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df58c8556cb75089ac8f96ae8e48bdba8d9818841517db1fd38a939fd842e0ee
|
|
| MD5 |
9cae51607e4ac8299386e347ecce90b7
|
|
| BLAKE2b-256 |
5744f64145e3d9ecfd6f05320263e6124099bdd3d0b3d5954923e68ab0e4043e
|