Changes between Version 1 and Version 2 of Ticket #31573, comment 2
- Timestamp:
- May 12, 2020, 6:55:24 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #31573, comment 2
v1 v2 1 For anyone interested in implementing this feature you'll have to override the `as_sql` and `pre_sql_setup` methods of `django.db.models.sql.compiler.SQLUpdateCompiler` in `django.db.backends.mysql.compiler.SQLUpdateCompiler` to [https://github.com/django/django/blob/d51e090db2110f016dbca1d794c0d379b3df551b/django/db/models/sql/compiler.py#L1535 avoid clearing the ordering] and append the `ORDER BY ` clause to `super().as_sql()[0]`.1 For anyone interested in implementing this feature you'll have to override the `as_sql` and `pre_sql_setup` methods of `django.db.models.sql.compiler.SQLUpdateCompiler` in `django.db.backends.mysql.compiler.SQLUpdateCompiler` to [https://github.com/django/django/blob/d51e090db2110f016dbca1d794c0d379b3df551b/django/db/models/sql/compiler.py#L1535 avoid clearing the ordering] and append the `ORDER BY ...` clause to `super().as_sql()[0]`.