@@ -0,0 +1,1898 @@
+import signal%0Aimport sys%0Afrom optparse import make_option%0Afrom orbit import satellite%0A%0Afrom django.core.management.base import BaseCommand, CommandError%0A%0Afrom base.models import Satellite%0A%0A%0Adef signal_handler(signal, frame):%0A        print('You pressed Ctrl+C!')%0A        sys.exit(0)%0Asignal.signal(signal.SIGINT, signal_handler)%0A%0A%0Aclass Command(BaseCommand):%0A    option_list = BaseCommand.option_list + (%0A        make_option('--delete',%0A                    action='store_true',%0A                    dest='delete',%0A                    default=False,%0A                    help='Delete Satellites'),%0A    )%0A    args = '%3CSatellite Range%3E'%0A    help = 'Updates/Inserts TLEs for a range of Satellites (eg. xxxx:xxxx)'%0A%0A    def handle(self, *args, **options):%0A        for arg in args:%0A            try:%0A                start, end = arg.split(':')%0A            except ValueError:%0A                raise CommandError('You need to spacify the range in the form: xxxx:xxxx')%0A%0A        r = range(int(start), int(end))%0A        for item in r:%0A            if options%5B'delete'%5D:%0A                try:%0A                    Satellite.objects.get(norad_cat_id=item).delete()%0A                    self.stdout.write('Satellite %7B%7D: deleted'.format(item))%0A                    continue%0A                except:%0A                    self.stdout.write('Satellite with Identifier %7B%7D does not exist'.format(item))%0A                    continue%0A%0A            try:%0A                sat = satellite(item)%0A            except:%0A                self.stdout.write('Satellite with Identifier %7B%7D does not exist'.format(item))%0A                continue%0A%0A            try:%0A                obj = Satellite.objects.get(norad_cat_id=item)%0A            except:%0A                obj = Satellite(norad_cat_id=item)%0A%0A            obj.name = sat.name()%0A            obj.save()%0A%0A            self.stdout.write('fetched data for %7B%7D: %7B%7D'.format(obj.norad_cat_id, obj.name))%0A

Add fetch_range_tle command