#32297: QuerySet.get() method not working as expected with Window functions
-------------------------------------+-------------------------------------
Reporter: Jerin | Owner: nobody
Peter George |
Type: Bug | Status: new
Component: Database | Version: master
layer (models, ORM) |
Severity: Normal | Keywords:
Triage Stage: | Has patch: 0
Unreviewed |
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-------------------------------------+-------------------------------------
I have a simple model as below,
{{{
class Employee(models.Model):
name = models.CharField(max_length=40, blank=False, null=False)
salary = models.PositiveIntegerField()
}}}
and I queried
{{{
qs = Employee.objects.annotate(
rank=Window(expression=Rank(), order_by=F("salary").desc()),
)
}}}
and then I have called the `get()` method to get the rank of a single
specific object
{{{
qs.get(pk=pk).rank
}}}
**Issue**
The `get(pk=pk).rank` returning a constant value irrespective of the
`kwargs` applied to the `get()` method
--
Ticket URL: <https://code.djangoproject.com/ticket/32297>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/059.f021e6c2b9898b4726b6eafb19d2713d%40djangoproject.com.