def handle(self, *args, **options): # Migrate self.stdout.write("Creating database...") call_command('migrate') # Initial data call_command('loaddata', 'antennas') call_command('fetch_data') # Create random fixtures for remaining models self.stdout.write("Creating fixtures...") StationFactory.create_batch( 10, antennas=(Antenna.objects.all().values_list('id', flat=True))) ObservationFactory.create_batch(20) for _ in range(40): DemodDataFactory.create( payload_demod__data=generate_payload(), payload_demod__filename=generate_payload_name()) # Update TLEs call_command('update_all_tle') # Create superuser self.stdout.write("Creating a superuser...") call_command('createsuperuser')
def setUp(self): for x in xrange(1, 10): self.satellites.append(SatelliteFactory()) for x in xrange(1, 10): self.transmitters.append(TransmitterFactory()) for x in xrange(1, 10): self.stations.append(StationFactory()) self.observation = ObservationFactory()
def handle(self, *args, **options): # Migrate call_command('migrate') # 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))) # Update TLEs call_command('update_all_tle') # Create superuser call_command('createsuperuser')
def handle(self, *args, **options): ObservationFactory.create_batch(20) StationFactory.create_batch(20) satellites = Satellite.objects.all() for obj in satellites: try: sat = satellite(obj.norad_cat_id) except: self.stdout.write(('Satellite {} with Identifier {} does ' 'not exist [deleted]').format(obj.name, obj.norad_cat_id)) obj.delete() continue obj.name = sat.name() tle = sat.tle() obj.tle0 = tle[0] obj.tle1 = tle[1] obj.tle2 = tle[2] obj.save() self.stdout.write(('Satellite {} with Identifier {} ' 'found [updated]').format(obj.norad_cat_id, obj.name))