summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/operations.py
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-04 08:08:27 +0100
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2022-02-07 20:37:05 +0100
commit7119f40c9881666b6f9b5cf7df09ee1d21cc8344 (patch)
treefa50869f5614295f462d9bf77fec59365c621609 /django/db/backends/postgresql/operations.py
parent9c19aff7c7561e3a82978a272ecdaad40dda5c00 (diff)
downloaddjango-7119f40c9881666b6f9b5cf7df09ee1d21cc8344.tar.gz
Refs #33476 -- Refactored code to strictly match 88 characters line length.
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r--django/db/backends/postgresql/operations.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py
index 68448157ec..49a61d148a 100644
--- a/django/db/backends/postgresql/operations.py
+++ b/django/db/backends/postgresql/operations.py
@@ -187,11 +187,12 @@ class DatabaseOperations(BaseDatabaseOperations):
output = []
qn = self.quote_name
for model in model_list:
- # Use `coalesce` to set the sequence for each model to the max pk value if there are records,
- # or 1 if there are none. Set the `is_called` property (the third argument to `setval`) to true
- # if there are records (as the max pk value is already in use), otherwise set it to false.
- # Use pg_get_serial_sequence to get the underlying sequence name from the table name
- # and column name (available since PostgreSQL 8)
+ # Use `coalesce` to set the sequence for each model to the max pk
+ # value if there are records, or 1 if there are none. Set the
+ # `is_called` property (the third argument to `setval`) to true if
+ # there are records (as the max pk value is already in use),
+ # otherwise set it to false. Use pg_get_serial_sequence to get the
+ # underlying sequence name from the table name and column name.
for f in model._meta.local_fields:
if isinstance(f, models.AutoField):
@@ -209,7 +210,9 @@ class DatabaseOperations(BaseDatabaseOperations):
style.SQL_TABLE(qn(model._meta.db_table)),
)
)
- break # Only one AutoField is allowed per model, so don't bother continuing.
+ # Only one AutoField is allowed per model, so don't bother
+ # continuing.
+ break
return output
def prep_for_iexact_query(self, x):