def handle(self, *args, **kwargs): create_index_table() for model in SEARCHABLE.values(): count = 0 for inst in model.objects.all(): inst.index() count += 1 if count: self.stdout.write('Indexed {} content.'.format(model.__name__)) self.stdout.write('Done reindexing.')
def handle(self, *args, **kwargs): create_index_table() for model in SEARCHABLE.values(): count = 0 for inst in model.objects.all(): inst.index() count += 1 if count: self.stdout.write("Indexed {} content.".format(model.__name__)) self.stdout.write("Done reindexing.")
def test_index_table_is_not_in_default_db(): create_index_table(force=True) cursor = connections['default'].cursor() cursor.execute("SELECT count(*) FROM sqlite_master " "WHERE type='table' AND name='idx';") count = cursor.fetchone()[0] assert count == 0 cursor = connections['transient'].cursor() cursor.execute("SELECT count(*) FROM sqlite_master " "WHERE type='table' AND name='idx';") count = cursor.fetchone()[0] assert count == 1
def database_forwards(self, app_label, schema_editor, from_state, to_state): # Don't run the parent method, we create the table our own way model = to_state.apps.get_model(app_label, self.name) if self.allow_migrate_model(schema_editor.connection.alias, model): create_index_table()
def cleansearch(): create_index_table(force=True)
def database_forwards(self, *_): # Don't run the parent method, we create the table our own way create_index_table()