Changes between Version 25 and Version 26 of QuerysetRefactorBranch
- Timestamp:
- Aug 1, 2008, 11:53:43 AM (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
QuerysetRefactorBranch
v25 v26 46 46 This only applies to ordering by items in an `extra(select={...})` dictionary. Normal ordering is still done with the `order_by()` method to querysets, there have been no changes there. So this change will affect relatively few people. 47 47 * A couple of changes to `order_by()`: 48 * Previously, i tyou passed no arguments to `order_by()`, it did nothing. Now, it clears the ordering (previously there was no way to remove any existing ordering). So if you are expecting the "do nothing" behaviour, make sure to check the arguments you are passing to `order_by()` and don't call it if you have no arguments.48 * Previously, if you passed no arguments to `order_by()`, it did nothing. Now, it clears the ordering (previously there was no way to remove any existing ordering). So if you are expecting the "do nothing" behaviour, make sure to check the arguments you are passing to `order_by()` and don't call it if you have no arguments. 49 49 * `order_by()` will raise an error if you try to order by a related model and resolving that model's standard ordering leads to an infinite loop (ordering by a related model tacks the target model's default ordering onto the end). This commonly comes up when ordering by a `ForeignKey` to "self". The previous code wouldn't raise an error here, but the results weren't particularly intuitive. However, if you still want the old behaviour, specify the ordering constraint explicitly so that it ends in a non-related field. For the "reference to self" case, you could make this change: 50 50 {{{