![]() ![]() Run DJANGO_SETTINGS_MODULE=ttings python test-script.py.Sample projet to reproduce (sqlite db included) ( Model, test file). The difference between the two methods that can explain this is that in Django 2.1, we have a check on the actual field instances thanks to other_args, but in 2.2, because of identity which is the class of the field, we can't distinguish two fields of the same type (please refer to the respective implementations to know the values of other_args and identity). This is correct again.įrom the debugging I did, it seems to come from this commit: If I revert def _eq_ back to what it was in Django 2.1 ( ) it works as normal again. This will print the same query as above which is incorrect. # SELECT "union_listing"."id", "union_listing"."sale_price", "union_listing"."yearly_rent" FROM "union_listing" UNION SELECT "union_listing"."id", "union_listing"."sale_price", "union_listing"."yearly_rent" FROM "union_listing" ORDER BY (2) ASC Yearly_rent = models.DecimalField('Yearly rent', max_digits=10, decimal_places=2) Sale_price = models.DecimalField('Sale price', max_digits=10, decimal_places=2) values('field1', 'field2') on the base querysets or after the union has no effect.įor instance, with this model, with 2 DecimalFields and one BooleanField: When doing a union of 2 querysets and then doing an order_by on the resulting queryset, if we order on a field whose type is present multiple time, the ordering will be incorrect if the field we sort on is not the 1st field of the query.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |