Changeset 9057


Ignore:
Timestamp:
Apr 15, 2011, 9:27:48 PM (14 years ago)
Author:
rick
Message:

Make it a actual embedded django command.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • src/django_gheat/gheat/management/commands/add_random_points.py

    r9056 r9057  
    44#
    55# Rick van der Zwet <info@rickvanderzwet.nl>
    6 import settings
    7 from django.core.management import setup_environ
    8 setup_environ(settings)
    9 
    10 
    116from django.db import connection, transaction
     7from django.core.management.base import BaseCommand
    128from gheat.models import *
     9from optparse import OptionParser, make_option
    1310import datetime
    1411import os
     
    5249
    5350
     51class Command(BaseCommand):
     52    option_list = BaseCommand.option_list + (
     53        make_option("-c", "--count", dest="count", type="int", default=100, help="Number of points to add"),
     54    )
     55
     56    def handle(self, *args, **options):
     57        add_random_measurements(options['count'])
     58
    5459if __name__ == "__main__":
    5560  # Awefull hack for argument parsing
Note: See TracChangeset for help on using the changeset viewer.