def handle(self, *args, **kwargs): print kwargs data_loader = DataLoader(**kwargs) # If no arguments are given to this command run all the import # methods. if len(args) == 0: data_loader.setup() if kwargs['limit_import']: lga_ids = settings.LIMITED_LGA_LIST else: lga_ids = [str(i['id']) for i in LGA.objects.filter(data_available=True).values('id')] if not kwargs['spawn_subprocess']: #load fixtures the old fashioned way. data_loader.load(lga_ids) data_loader.print_stats() else: print "Starting subprocess to load lga data in." ccargs = ['load_lgas'] + lga_ids #calling "load_lgas" with arguments. call_command(*ccargs) # If arguments have been given to this command, run those # methods in the order they have been specified. for arg in args: if hasattr(data_loader, arg): method = getattr(data_loader, arg) method() else: print "Unknown command:", arg