2014-10-27 12:16:38 -06:00
|
|
|
from django.core.management.base import BaseCommand
|
2015-08-26 04:30:09 -06:00
|
|
|
from django.core.management import call_command
|
2014-10-27 12:16:38 -06:00
|
|
|
|
|
|
|
|
|
|
|
class Command(BaseCommand):
|
|
|
|
help = 'Create initial fixtures'
|
|
|
|
|
|
|
|
def handle(self, *args, **options):
|
2015-08-26 04:30:09 -06:00
|
|
|
# Migrate
|
|
|
|
call_command('migrate')
|
2014-10-27 12:16:38 -06:00
|
|
|
|
2015-08-26 04:30:09 -06:00
|
|
|
# Initial data
|
|
|
|
call_command('loaddata', 'antennas')
|
|
|
|
call_command('fetch_data')
|
|
|
|
|
|
|
|
# Create random fixtures for remaining models
|
|
|
|
from network.base.tests import ObservationFactory, StationFactory
|
|
|
|
from network.base.models import Antenna
|
|
|
|
ObservationFactory.create_batch(20)
|
|
|
|
StationFactory.create_batch(10,
|
|
|
|
antennas=(Antenna.objects.all().values_list('id', flat=True)))
|
2014-10-27 12:16:38 -06:00
|
|
|
|
2015-08-26 04:30:09 -06:00
|
|
|
# Update TLEs
|
|
|
|
call_command('update_all_tle')
|
2014-10-27 12:16:38 -06:00
|
|
|
|
2015-08-26 04:30:09 -06:00
|
|
|
# Create superuser
|
|
|
|
call_command('createsuperuser')
|