{{{#!python
class RankTest(models.Model):
name = models.CharField(max_length=30)
category = models.CharField(max_length=30)
rating = models.DecimalField(max_digits=8, decimal_places=5)
list(
RankTest.objects.annotate(
rank=Window(
expression=Rank(),
order_by='rating'
)
)
)
}}}
The solution implemented in #31723
(71d10ca8c90ccc1fd0ccd6683716dd3c3116ae6a) wish addressed the improper of
casting for `Window.expression` caused some problematic one for `order_by`
and likely `partition_by` as well.
--
Ticket URL: <https://code.djangoproject.com/ticket/35064>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/35064#comment:1>
* owner: nobody => Simon Charette
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/35064#comment:2>
* has_patch: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/35064#comment:3>
* stage: Accepted => Ready for checkin
--
Ticket URL: <https://code.djangoproject.com/ticket/35064#comment:4>
Comment (by Mariusz Felisiak <felisiak.mariusz@…>):
In [changeset:"90d365d869924d503565eb1ccdc24077d60faf0c" 90d365d8]:
{{{
#!CommitTicketReference repository=""
revision="90d365d869924d503565eb1ccdc24077d60faf0c"
Refs #35064 -- Made OrderableAggMixin avoid creating empty OrderByList.
This paves the way for making OrderByList a simple shim over
ExpressionList which requires at least a single item to be provided.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35064#comment:5>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"e16d0c176e9b89628cdec5e58c418378c4a2436a" e16d0c1]:
{{{
#!CommitTicketReference repository=""
revision="e16d0c176e9b89628cdec5e58c418378c4a2436a"
Fixed #35064 -- Fixed Window(order_by) crash with DecimalFields on SQLite.
This avoids cast of Window(order_by) for DecimalFields on SQLite.
This was achieved by piggy-backing ExpressionList which already
implements a specialized as_sqlite() method to override the inherited
behaviour of Func through SQLiteNumericMixin.
Refs #31723.
Thanks Quoates for the report.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/35064#comment:6>