diff options
author | Matthew Wilkes <git@matthewwilkes.name> | 2017-06-18 16:53:40 +0100 |
---|---|---|
committer | Tim Graham <timograham@gmail.com> | 2018-02-10 19:08:55 -0500 |
commit | 2162f0983de0dfe2178531638ce7ea56f54dd4e7 (patch) | |
tree | bb1e859159200fa7ebeeaa02ec3908e1cf5d2655 /django/db/backends/postgresql/operations.py | |
parent | bf26f66029bca94b007a2452679ac004598364a6 (diff) | |
download | django-2162f0983de0dfe2178531638ce7ea56f54dd4e7.tar.gz |
Fixed #24747 -- Allowed transforms in QuerySet.order_by() and distinct(*fields).
Diffstat (limited to 'django/db/backends/postgresql/operations.py')
-rw-r--r-- | django/db/backends/postgresql/operations.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/django/db/backends/postgresql/operations.py b/django/db/backends/postgresql/operations.py index 3b71cd4f2c..6f48cfa228 100644 --- a/django/db/backends/postgresql/operations.py +++ b/django/db/backends/postgresql/operations.py @@ -207,11 +207,12 @@ class DatabaseOperations(BaseDatabaseOperations): """ return 63 - def distinct_sql(self, fields): + def distinct_sql(self, fields, params): if fields: - return 'DISTINCT ON (%s)' % ', '.join(fields) + params = [param for param_list in params for param in param_list] + return (['DISTINCT ON (%s)' % ', '.join(fields)], params) else: - return 'DISTINCT' + return ['DISTINCT'], [] def last_executed_query(self, cursor, sql, params): # http://initd.org/psycopg/docs/cursor.html#cursor.query |