Skip to main content

Helper class for generate sampledata

Project description

Helper class to create django sample data.


Sample data command for generate instances of MyModel:

from import BaseCommand
from myapp.models import MyModel
from sampledatahelper.helper import SampleDataHelper

class Command(BaseCommand):
    args = ''
    help = 'Example data generator'
    sd = SampleDataHelper(seed=12345678901)

    def generate_mymodel_data(self, instances):
        for x in range(instances):
            instance = MyModel.objects.create(
      , 3),
      , 3)
      , 64),

    def handle(self, *args, **options):
        print "Generating MyModel data"


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.

Source Distribution

django-sampledatahelper-0.1.tar.gz (11.0 kB view hashes)

Uploaded source

Supported by

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