Used None as the empty value for condition in Index's SQL construction.

This commit is contained in:
Paveł Tyślacki 2019-01-12 01:47:56 +03:00 committed by Tim Graham
parent f4c0c0b0aa
commit 1e837c4b23
2 changed files with 2 additions and 2 deletions

View File

@ -894,7 +894,7 @@ class BaseDatabaseSchemaEditor:
def _create_index_sql(self, model, fields, *, name=None, suffix='', using='',
db_tablespace=None, col_suffixes=(), sql=None, opclasses=(),
condition=''):
condition=None):
"""
Return the SQL statement to create the index for one or several fields.
`sql` can be specified if the syntax differs from the standard (GIS

View File

@ -57,7 +57,7 @@ class Index:
def _get_condition_sql(self, model, schema_editor):
if self.condition is None:
return ''
return None
query = Query(model=model)
query.add_q(self.condition)
compiler = query.get_compiler(connection=schema_editor.connection)