def handle(self, *args, **options): try: command = args[0] except: raise CommandError('Please provide a valid command') if command == 'rebuild': for model in site.get_models(): self.stdout.write('Creating index for %s... ' % model.get_name()) create_index(model) update_index(model) self.stdout.write('DONE\n')
def create_index_handler(search_model, sender=None, **kwargs): """ Used on syncdb""" utils.create_index(search_model)
def rebuild(self): mod = site.get_search_model(self.model) if mod: utils.create_index(mod) utils.update_index(mod)