summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql_psycopg2/operations.py
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2014-09-04 08:15:09 -0400
committerTim Graham <timograham@gmail.com>2014-09-05 09:22:16 -0400
commit1101467ce0756272a54f4c7bc65c4c335a94111b (patch)
treeddfd451bbc041d69284d3685e351ffc88872780e /django/db/backends/postgresql_psycopg2/operations.py
parentf8bb8436e533abad563b5235cf0e62e42dbc5f01 (diff)
downloaddjango-1101467ce0756272a54f4c7bc65c4c335a94111b.tar.gz
Limited lines to 119 characters in django/
refs #23395.
Diffstat (limited to 'django/db/backends/postgresql_psycopg2/operations.py')
-rw-r--r--django/db/backends/postgresql_psycopg2/operations.py44
1 files changed, 26 insertions, 18 deletions
diff --git a/django/db/backends/postgresql_psycopg2/operations.py b/django/db/backends/postgresql_psycopg2/operations.py
index b9d0231768..0e512b91fa 100644
--- a/django/db/backends/postgresql_psycopg2/operations.py
+++ b/django/db/backends/postgresql_psycopg2/operations.py
@@ -164,27 +164,35 @@ class DatabaseOperations(BaseDatabaseOperations):
for f in model._meta.local_fields:
if isinstance(f, models.AutoField):
- output.append("%s setval(pg_get_serial_sequence('%s','%s'), coalesce(max(%s), 1), max(%s) %s null) %s %s;" %
- (style.SQL_KEYWORD('SELECT'),
- style.SQL_TABLE(qn(model._meta.db_table)),
- style.SQL_FIELD(f.column),
- style.SQL_FIELD(qn(f.column)),
- style.SQL_FIELD(qn(f.column)),
- style.SQL_KEYWORD('IS NOT'),
- style.SQL_KEYWORD('FROM'),
- style.SQL_TABLE(qn(model._meta.db_table))))
+ output.append(
+ "%s setval(pg_get_serial_sequence('%s','%s'), "
+ "coalesce(max(%s), 1), max(%s) %s null) %s %s;" % (
+ style.SQL_KEYWORD('SELECT'),
+ style.SQL_TABLE(qn(model._meta.db_table)),
+ style.SQL_FIELD(f.column),
+ style.SQL_FIELD(qn(f.column)),
+ style.SQL_FIELD(qn(f.column)),
+ style.SQL_KEYWORD('IS NOT'),
+ style.SQL_KEYWORD('FROM'),
+ style.SQL_TABLE(qn(model._meta.db_table)),
+ )
+ )
break # Only one AutoField is allowed per model, so don't bother continuing.
for f in model._meta.many_to_many:
if not f.rel.through:
- output.append("%s setval(pg_get_serial_sequence('%s','%s'), coalesce(max(%s), 1), max(%s) %s null) %s %s;" %
- (style.SQL_KEYWORD('SELECT'),
- style.SQL_TABLE(qn(f.m2m_db_table())),
- style.SQL_FIELD('id'),
- style.SQL_FIELD(qn('id')),
- style.SQL_FIELD(qn('id')),
- style.SQL_KEYWORD('IS NOT'),
- style.SQL_KEYWORD('FROM'),
- style.SQL_TABLE(qn(f.m2m_db_table()))))
+ output.append(
+ "%s setval(pg_get_serial_sequence('%s','%s'), "
+ "coalesce(max(%s), 1), max(%s) %s null) %s %s;" % (
+ style.SQL_KEYWORD('SELECT'),
+ style.SQL_TABLE(qn(f.m2m_db_table())),
+ style.SQL_FIELD('id'),
+ style.SQL_FIELD(qn('id')),
+ style.SQL_FIELD(qn('id')),
+ style.SQL_KEYWORD('IS NOT'),
+ style.SQL_KEYWORD('FROM'),
+ style.SQL_TABLE(qn(f.m2m_db_table()))
+ )
+ )
return output
def prep_for_iexact_query(self, x):