diff options
author | Дилян Палаузов <Dilyan.Palauzov@db.com> | 2018-01-03 18:52:12 -0500 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2018-01-03 20:12:23 -0500 |
commit | d7b2aa24f75434c2ce50100cfef3586071e0747a (patch) | |
tree | 9074eb7522888e744f948c52174f367a4281c200 /django/db/backends/postgresql/operations.py | |
parent | c2d0f8c084456b5073252a91eeb09ab3d7453b18 (diff) | |
download | django-d7b2aa24f75434c2ce50100cfef3586071e0747a.tar.gz |
Fixed #28982 -- Simplified code with and/or.
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r-- | django/db/backends/postgresql/operations.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py index 06a46f4303..3b71cd4f2c 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -131,11 +131,9 @@ class DatabaseOperations(BaseDatabaseOperations): sql = [] for sequence_info in sequences: table_name = sequence_info['table'] - column_name = sequence_info['column'] - if not column_name: - # This will be the case if it's an m2m using an autogenerated - # intermediate table (see BaseDatabaseIntrospection.sequence_list) - column_name = 'id' + # 'id' will be the case if it's an m2m using an autogenerated + # intermediate table (see BaseDatabaseIntrospection.sequence_list). + column_name = sequence_info['column'] or 'id' sql.append("%s setval(pg_get_serial_sequence('%s','%s'), 1, false);" % ( style.SQL_KEYWORD('SELECT'), style.SQL_TABLE(self.quote_name(table_name)), |