예제 #1
0
 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.')
예제 #2
0
 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.")
예제 #3
0
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
예제 #4
0
 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()
예제 #5
0
파일: conftest.py 프로젝트: blqn/ideascube
def cleansearch():
    create_index_table(force=True)
예제 #6
0
def cleansearch():
    create_index_table(force=True)
예제 #7
0
 def database_forwards(self, *_):
     # Don't run the parent method, we create the table our own way
     create_index_table()
예제 #8
0
 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()