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 update_index_handler(search_model, sender, instance, created, **kwargs): """ Update a record in search index, used on post_save """ utils.update_index(search_model, instance, created)
def rebuild(self): mod = site.get_search_model(self.model) if mod: utils.create_index(mod) utils.update_index(mod)