summaryrefslogtreecommitdiff
path: root/django/core/management/commands/createcachetable.py
diff options
context:
space:
mode:
Diffstat (limited to 'django/core/management/commands/createcachetable.py')
-rw-r--r--django/core/management/commands/createcachetable.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/core/management/commands/createcachetable.py b/django/core/management/commands/createcachetable.py
index 4d1bc0403e..d7ce3e93fd 100644
--- a/django/core/management/commands/createcachetable.py
+++ b/django/core/management/commands/createcachetable.py
@@ -38,7 +38,7 @@ class Command(LabelCommand):
qn = connection.ops.quote_name
for f in fields:
field_output = [qn(f.name), f.db_type(connection=connection)]
- field_output.append("%sNULL" % (not f.null and "NOT " or ""))
+ field_output.append("%sNULL" % ("NOT " if not f.null else ""))
if f.primary_key:
field_output.append("PRIMARY KEY")
elif f.unique:
@@ -51,7 +51,7 @@ class Command(LabelCommand):
table_output.append(" ".join(field_output))
full_statement = ["CREATE TABLE %s (" % qn(tablename)]
for i, line in enumerate(table_output):
- full_statement.append(' %s%s' % (line, i < len(table_output)-1 and ',' or ''))
+ full_statement.append(' %s%s' % (line, ',' if i < len(table_output)-1 else ''))
full_statement.append(');')
with transaction.commit_on_success_unless_managed():
curs = connection.cursor()