コード例 #1
0
 class Meta:
     verbose_name = "ToDo"
     verbose_name_plural = "ToDos"
     indexes = [
         Index(fields=["user", "is_done"])
     ]
     ordering = ["-created_at"]
コード例 #2
0
    def create_sql(self, model, schema_editor, using=''):
        """Creates the actual SQL used when applying the migration."""

        sql_create_index = self.sql_create_index
        sql_parameters = {
            **Index.get_sql_create_template_values(self, model, schema_editor, using), 'condition':
            self.condition
        }
        return sql_create_index % sql_parameters
コード例 #3
0
 class Meta:
     managed = False
     db_table = 'sys_menu'
     verbose_name = '메뉴'
     verbose_name_plural = '메뉴'
     constraints = [
         UniqueConstraint(fields=['menu_cd', 'parent_menu_cd'],
                          name='sys_menu_uk')
     ]
     indexes = [
         Index(fields=['menu_name_ko', 'menu_name_en', 'url', 'use_yn'],
               name='sys_menu_ix1'),
     ]
コード例 #4
0
 def create_sql(self, model, schema_editor, using=''):
     """Creates the actual SQL used when applying the migration."""
     if django.VERSION >= (2, 0):
         statement = super().create_sql(model, schema_editor, using)
         statement.template = self.sql_create_index
         statement.parts['condition'] = self.condition
         return statement
     else:
         sql_create_index = self.sql_create_index
         sql_parameters = {
             **Index.get_sql_create_template_values(self, model, schema_editor, using), 'condition':
             self.condition
         }
         return sql_create_index % sql_parameters
コード例 #5
0
ファイル: models.py プロジェクト: gdcollect/django-zombodb
 class Meta:
     indexes = [
         Index(name='other-index', fields=['url']),
         ZomboDBIndex(url='http://localhost:9200/',
                      fields=[
                          'name',
                          'street',
                          'zip_code',
                          'city',
                          'state',
                          'phone',
                          'email',
                          'website',
                          'categories',
                      ]),
     ]
コード例 #6
0
 class Meta:
     ordering = ('subject_identifier', 'status_date', '-created')
     indexes = [
         Index(fields=['subject_identifier', 'status_date']),
         Index(fields=['subject_identifier', 'status_date', '-created'])
     ]