Re: [Django] #29538: Query Expression in ordering of a related object fails

2023-03-28 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Eduardo
 |  Rivas
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  ordering, query  | Triage Stage:  Ready for
  expression, related object |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak):

 Replying to [comment:16 a-p-f]:
 > Sorry for my ignorance, but is there a simple way for users to see, from
 this page, which minor versions of Django have received this patch? I
 followed the link to the github commit page, and from what I could tell
 there, the fix was implemented in 4.1. That doesn't tell me, however, if
 the commit was cherry-picked into any other branches.
 >
 > At first I had assumed that since 3.2 was the latest LTS release, it
 would receive this fix. I upgraded to 3.2.18, though, and this bug isn't
 fixed. Looking closer at Django's docs, I see that 3.2 is only in extended
 support, and this bug does not qualify for extended support. Fair enough.
 I just think it would help developers to make it clear which of the
 current versions have received a given fix.

 You can click commit (2798c937deb6625a4e6a36e70d4d60ce5faac954) which
 fixed this issue and check tags, `4.1a1` so it's fixed in Django 4.1+.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018728e0a319-25597355-45cd-48d9-86c1-826bf51bc5ad-00%40eu-central-1.amazonses.com.


Re: [Django] #29538: Query Expression in ordering of a related object fails

2023-03-28 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Eduardo
 |  Rivas
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  ordering, query  | Triage Stage:  Ready for
  expression, related object |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by a-p-f):

 Sorry for my ignorance, but is there a simple way for users to see, from
 this page, which minor versions of Django have received this patch? I
 followed the link to the github commit page, and from what I could tell
 there, the fix was implemented in 4.1. That doesn't tell me, however, if
 the commit was cherry-picked into any other branches.

 At first I had assumed that since 3.2 was the latest LTS release, it would
 receive this fix. I upgraded to 3.2.18, though, and this bug isn't fixed.
 Looking closer at Django's docs, I see that 3.2 is only in extended
 support, and this bug does not qualify for extended support. Fair enough.
 I just think it would help developers to make it clear which of the
 current versions have received a given fix.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018728c35509-694879b3-1d05-4a09-9277-c404277deb39-00%40eu-central-1.amazonses.com.


Re: [Django] #29538: Query Expression in ordering of a related object fails

2022-05-11 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Eduardo
 |  Rivas
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:  ordering, query  | Triage Stage:  Ready for
  expression, related object |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak ):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"2798c937deb6625a4e6a36e70d4d60ce5faac954" 2798c937]:
 {{{
 #!CommitTicketReference repository=""
 revision="2798c937deb6625a4e6a36e70d4d60ce5faac954"
 Fixed #29538 -- Fixed crash of ordering by related fields when
 Meta.ordering contains expressions.

 Thanks Simon Charette for the review.
 }}}

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070180b708f95d-80fe1187-9a82-4ef5-921f-ce86cf925454-00%40eu-central-1.amazonses.com.


Re: [Django] #29538: Query Expression in ordering of a related object fails

2022-05-11 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Eduardo
 |  Rivas
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ordering, query  | Triage Stage:  Ready for
  expression, related object |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * stage:  Accepted => Ready for checkin


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070180b6bab8c0-7d4731ec-e39d-4f41-9b0c-85c1ef4b1691-00%40eu-central-1.amazonses.com.


Re: [Django] #29538: Query Expression in ordering of a related object fails

2022-05-10 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Eduardo
 |  Rivas
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ordering, query  | Triage Stage:  Accepted
  expression, related object |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Simon Charette):

 * needs_tests:  1 => 0


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070180ae62b4f6-cf482242-4e5b-4b2a-a613-81a67ad6e186-00%40eu-central-1.amazonses.com.


Re: [Django] #29538: Query Expression in ordering of a related object fails

2022-05-05 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Eduardo
 |  Rivas
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ordering, query  | Triage Stage:  Accepted
  expression, related object |
Has patch:  1|  Needs documentation:  0
  Needs tests:  1|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Mariusz Felisiak):

 * needs_tests:  0 => 1


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/0107018097b56aee-5c4f5819-01f7-4ce3-85e1-e771da93280a-00%40eu-central-1.amazonses.com.


Re: [Django] #29538: Query Expression in ordering of a related object fails

2022-05-05 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Eduardo
 |  Rivas
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ordering, query  | Triage Stage:  Accepted
  expression, related object |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Eduardo Rivas):

 * owner:  Alexandre Laplante => Eduardo Rivas


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701809520a97b-bac00271-aa72-43ab-8026-8646b1e0aed2-00%40eu-central-1.amazonses.com.


Re: [Django] #29538: Query Expression in ordering of a related object fails

2022-05-05 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Alexandre
 |  Laplante
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ordering, query  | Triage Stage:  Accepted
  expression, related object |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Eduardo Rivas):

 * cc: Eduardo Rivas (added)
 * needs_better_patch:  1 => 0


Comment:

 [https://github.com/django/django/pull/15666 PR]

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070180951fc332-7d2f242e-054c-4be8-89f1-816e0b0b52c4-00%40eu-central-1.amazonses.com.


Re: [Django] #29538: Query Expression in ordering of a related object fails

2022-05-04 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Alexandre
 |  Laplante
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ordering, query  | Triage Stage:  Accepted
  expression, related object |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Simon Charette):

 If anyone is interested in addressing this ticket there's a possible
 implementation detailed in
 https://code.djangoproject.com/ticket/33678#comment:3

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701808f93f318-cee9b9fb-98dc-46fd-b72c-5c26a2d3133f-00%40eu-central-1.amazonses.com.


Re: [Django] #29538: Query Expression in ordering of a related object fails

2022-05-03 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Alexandre
 |  Laplante
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ordering, query  | Triage Stage:  Accepted
  expression, related object |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak):

 #33678 was a duplicate for functions in related `Meta.ordering`.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/010701808d4c91ea-03908e49-b4d5-4a3e-80c1-5ce63090490f-00%40eu-central-1.amazonses.com.


Re: [Django] #29538: Query Expression in ordering of a related object fails

2022-05-02 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Alexandre
 |  Laplante
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ordering, query  | Triage Stage:  Accepted
  expression, related object |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak):

 After 8c5f9906c56ac72fc4f13218dd90bdf9bc8a248b it crashes with:
 {{{
 django.core.exceptions.FieldError: Cannot resolve keyword 'instrument'
 into field. Choices are: artist, artist_id, id, name, num_stars,
 release_date
 }}}

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070180849ad537-7ffc20d3-8b85-490d-b396-83510184620b-00%40eu-central-1.amazonses.com.


Re: [Django] #29538: Query Expression in ordering of a related object fails

2019-01-14 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Alexandre
 |  Laplante
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ordering, query  | Triage Stage:  Accepted
  expression, related object |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by colons):

 * cc: colons (added)


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.2bc28634c387db53a2ea9ab3c60ec7fb%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29538: Query Expression in ordering of a related object fails

2018-09-12 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Alexandre
 |  Laplante
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ordering, query  | Triage Stage:  Accepted
  expression, related object |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  1
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson):

 * needs_better_patch:  0 => 1


-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.dd1ba5fd915987c05d24df146d1acfc7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29538: Query Expression in ordering of a related object fails

2018-07-07 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Alexandre
 |  Laplante
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ordering, query  | Triage Stage:  Accepted
  expression, related object |
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Alexandre Laplante):

 * has_patch:  0 => 1


Comment:

 [https://github.com/django/django/pull/10146 PR] Looking for feedback on
 this patch.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.28651e32f9f402f031385b95ae8c9ba6%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29538: Query Expression in ordering of a related object fails

2018-07-07 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  Alexandre
 |  Laplante
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ordering, query  | Triage Stage:  Accepted
  expression, related object |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Alexandre Laplante):

 * status:  new => assigned
 * owner:  nobody => Alexandre Laplante


Comment:

 Started working on a fix.

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.85612fdbb8ea60eb27e63ed5776adad7%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #29538: Query Expression in ordering of a related object fails (was: QueryExpression in ordering of a related object fails)

2018-07-03 Thread Django
#29538: Query Expression in ordering of a related object fails
-+-
 Reporter:  wilhelmhb|Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  2.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:  ordering, query  | Triage Stage:  Accepted
  expression, related object |
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * stage:  Unreviewed => Accepted


Old description:

> Since 2.0, according to the doc
> ([https://docs.djangoproject.com/en/2.0/ref/models/options/#ordering]),
> we can use QueryExpression objects in the Model.Meta.ordering field.
> Using:
>
> {{{
> from django.db import models
>
> class Musician(models.Model):
> first_name = models.CharField(max_length=50)
> last_name = models.CharField(max_length=50)
> instrument = models.CharField(max_length=100, null=True, blank=True)
>
> class Meta:
> ordering = [models.F('instrument').asc(null_last=True)]
>
> class Album(models.Model):
> artist = models.ForeignKey(Musician, on_delete=models.CASCADE)
> name = models.CharField(max_length=100)
> release_date = models.DateField()
> num_stars = models.IntegerField()
>
> class Meta:
> ordering = ['artist']
> }}}
> fails with {{{ TypeError: 'OrderBy' does not support indexing }}}
>
> When reaching
> [https://github.com/django/django/blob/master/django/db/models/sql/compiler.py#L669],
> the compiler tries to use the related model, but at line 679, {{{item}}}
> can be an OrderBy object. Thus the failure.

New description:

 Since 2.0, according to the doc
 ([https://docs.djangoproject.com/en/2.0/ref/models/options/#ordering]), we
 can use QueryExpression objects in the Model.Meta.ordering field.
 Using:

 {{{
 from django.db import models

 class Musician(models.Model):
 first_name = models.CharField(max_length=50)
 last_name = models.CharField(max_length=50)
 instrument = models.CharField(max_length=100, null=True, blank=True)

 class Meta:
 ordering = [models.F('instrument').asc(nulls_last=True)]

 class Album(models.Model):
 artist = models.ForeignKey(Musician, on_delete=models.CASCADE)
 name = models.CharField(max_length=100)
 release_date = models.DateField()
 num_stars = models.IntegerField()

 class Meta:
 ordering = ['artist']
 }}}
 {{{
 >>> Album.objects.all()
 ...
 TypeError: 'OrderBy' does not support indexing
 }}}

 When reaching
 
[https://github.com/django/django/blob/master/django/db/models/sql/compiler.py#L669],
 the compiler tries to use the related model, but at line 679, {{{item}}}
 can be an OrderBy object. Thus the failure.

--

-- 
Ticket URL: 
Django 
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/067.030123638c7f7d486fe0bfd8e0e7a0d4%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.