Re: [Django] #33945: get_previous_in_order and get_next_in_order return incorrect data when objects is stored in non-default database

2022-12-08 Thread Django
#33945: get_previous_in_order and get_next_in_order return incorrect data when
objects is stored in non-default database
-+-
 Reporter:  François Granade |Owner:  Aryan
 |  Amish
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Aryan Amish):

 * owner:  Wael Ramadan => Aryan Amish
 * status:  new => assigned


-- 
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/01070184f359cd82-55bed343-e0ea-4bef-a53e-f94ae15c8beb-00%40eu-central-1.amazonses.com.


Re: [Django] #33945: get_previous_in_order and get_next_in_order return incorrect data when objects is stored in non-default database

2022-10-17 Thread Django
#33945: get_previous_in_order and get_next_in_order return incorrect data when
objects is stored in non-default database
-+-
 Reporter:  François Granade |Owner:  Wael
 |  Ramadan
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Wael Ramadan):

 Replying to [comment:9 Wael Ramadan]:
 > Replying to [comment:8 Mariusz Felisiak]:
 > > Replying to [comment:6 Wael Ramadan]:
 > > > This has to be investigated as to what fixed the issue!
 > >
 > > It fails for me on the `main` branch, `stable/4.1.x` branch, and with
 `4.1.2` version so it's definitely not fixed.
 >
 > How is that possible that it fails on `4.1.2` what type of database are
 you using?

 OK, oddly enough purged everything and started from scratch using `4.1.2`
 and it does fail.

-- 
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/01070183e65a9ddf-91edf966-53a6-4c83-8bd8-37679382679a-00%40eu-central-1.amazonses.com.


Re: [Django] #33945: get_previous_in_order and get_next_in_order return incorrect data when objects is stored in non-default database

2022-10-17 Thread Django
#33945: get_previous_in_order and get_next_in_order return incorrect data when
objects is stored in non-default database
-+-
 Reporter:  François Granade |Owner:  Wael
 |  Ramadan
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Wael Ramadan):

 Replying to [comment:8 Mariusz Felisiak]:
 > Replying to [comment:6 Wael Ramadan]:
 > > This has to be investigated as to what fixed the issue!
 >
 > It fails for me on the `main` branch, `stable/4.1.x` branch, and with
 `4.1.2` version so it's definitely not fixed.

 How is that possible that it fails on `4.1.2` what type of database are
 you using?

-- 
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/01070183e6298e5c-e65d9d5f-c836-4a18-9271-9266b2f94e99-00%40eu-central-1.amazonses.com.


Re: [Django] #33945: get_previous_in_order and get_next_in_order return incorrect data when objects is stored in non-default database

2022-10-17 Thread Django
#33945: get_previous_in_order and get_next_in_order return incorrect data when
objects is stored in non-default database
-+-
 Reporter:  François Granade |Owner:  Wael
 |  Ramadan
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Mariusz Felisiak):

 Replying to [comment:6 Wael Ramadan]:
 > This has to be investigated as to what fixed the issue!

 It fails for me on the `main` branch, `stable/4.1.x` branch, and with
 `4.1.2` version so it's definitely not fixed.

-- 
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/01070183e61e40d6-8f304e30-e8d1-4120-b950-6d0c85e78788-00%40eu-central-1.amazonses.com.


Re: [Django] #33945: get_previous_in_order and get_next_in_order return incorrect data when objects is stored in non-default database

2022-10-16 Thread Django
#33945: get_previous_in_order and get_next_in_order return incorrect data when
objects is stored in non-default database
-+-
 Reporter:  François Granade |Owner:  Wael
 |  Ramadan
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Wael Ramadan):

 * status:  closed => new
 * resolution:  worksforme =>


-- 
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/01070183e2a4d670-ab4a2655-7500-4d88-9d86-185943ebde3e-00%40eu-central-1.amazonses.com.


Re: [Django] #33945: get_previous_in_order and get_next_in_order return incorrect data when objects is stored in non-default database

2022-10-16 Thread Django
#33945: get_previous_in_order and get_next_in_order return incorrect data when
objects is stored in non-default database
-+-
 Reporter:  François Granade |Owner:  Wael
 |  Ramadan
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |   Resolution:
 Severity:  Normal   |  worksforme
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Wael Ramadan):

 * status:  new => closed
 * resolution:   => worksforme


Comment:

 Using Django 4.1.1 this does actually fail. Yet when using Django 4.1.2
 this works perfectly. Yet looking at the Release notes
 (https://docs.djangoproject.com/en/4.1/releases/4.1.2/) there seems to be
 no mention of this ticket.

 This has to be investigated as to what fixed the issue!

-- 
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/01070183e2a0f7a5-810304dc-6bc4-4323-b654-8ec050d59284-00%40eu-central-1.amazonses.com.


Re: [Django] #33945: get_previous_in_order and get_next_in_order return incorrect data when objects is stored in non-default database

2022-10-16 Thread Django
#33945: get_previous_in_order and get_next_in_order return incorrect data when
objects is stored in non-default database
-+-
 Reporter:  François Granade |Owner:  Wael
 |  Ramadan
 Type:  Bug  |   Status:  new
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham):

 * status:  closed => new
 * has_patch:  1 => 0
 * resolution:  fixed =>


Comment:

 If that's the case, you should identify the commit that fixed the issue.
 The test that Carlton wrote in comment 2 still fails on the main and
 stable/4.1.x branches, so I have my doubts this is fixed.

-- 
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/01070183e2893aa3-9f45a256-9e4c-4f82-aad1-d7596b4b30ee-00%40eu-central-1.amazonses.com.


Re: [Django] #33945: get_previous_in_order and get_next_in_order return incorrect data when objects is stored in non-default database

2022-10-16 Thread Django
#33945: get_previous_in_order and get_next_in_order return incorrect data when
objects is stored in non-default database
-+-
 Reporter:  François Granade |Owner:  Wael
 |  Ramadan
 Type:  Bug  |   Status:  closed
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:  fixed
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Wael Ramadan):

 * status:  assigned => closed
 * has_patch:  0 => 1
 * resolution:   => fixed


-- 
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/01070183e0d9f29c-06def06f-9e81-4022-b6c6-d5a251f67d81-00%40eu-central-1.amazonses.com.


Re: [Django] #33945: get_previous_in_order and get_next_in_order return incorrect data when objects is stored in non-default database

2022-10-16 Thread Django
#33945: get_previous_in_order and get_next_in_order return incorrect data when
objects is stored in non-default database
-+-
 Reporter:  François Granade |Owner:  Wael
 |  Ramadan
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Wael Ramadan):

 This seems to be working correctly in Django 4.1.2

-- 
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/01070183e0cd5e5e-81a5ee47-4f36-41c3-9850-b25e7ee0f3c1-00%40eu-central-1.amazonses.com.


Re: [Django] #33945: get_previous_in_order and get_next_in_order return incorrect data when objects is stored in non-default database

2022-08-22 Thread Django
#33945: get_previous_in_order and get_next_in_order return incorrect data when
objects is stored in non-default database
-+-
 Reporter:  François Granade |Owner:  Wael
 |  Ramadan
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Carlton Gibson):

 * stage:  Unreviewed => Accepted


Comment:

 OK, I think this is valid. `Model._get_next_or_previous_in_order()`
 doesn't apply `using()` at all.
 
[https://github.com/django/django/blob/e9fd2b572410b1236da0d3d0933014138d89f44e/django/db/models/base.py#L1170-L1191
 src]

 Reproduces with the following diff:


 {{{
 diff --git a/tests/multiple_database/models.py
 b/tests/multiple_database/models.py
 index 7de784e149..4c8bdffb96 100644
 --- a/tests/multiple_database/models.py
 +++ b/tests/multiple_database/models.py
 @@ -79,3 +79,18 @@ class UserProfile(models.Model):

  class Meta:
  ordering = ("flavor",)
 +
 +
 +class Question(models.Model):
 +text = models.CharField(max_length=200)
 +
 +
 +class Answer(models.Model):
 +text = models.CharField(max_length=200)
 +question = models.ForeignKey(Question, models.CASCADE)
 +
 +class Meta:
 +order_with_respect_to = "question"
 +
 +def __str__(self):
 +return self.text
 diff --git a/tests/multiple_database/tests.py
 b/tests/multiple_database/tests.py
 index 7a9ff4da4e..8bf30c6fd9 100644
 --- a/tests/multiple_database/tests.py
 +++ b/tests/multiple_database/tests.py
 @@ -12,7 +12,7 @@ from django.db.models import signals
  from django.db.utils import ConnectionRouter
  from django.test import SimpleTestCase, TestCase, override_settings

 -from .models import Book, Person, Pet, Review, UserProfile
 +from .models import Book, Person, Pet, Review, UserProfile, Question,
 Answer
  from .routers import AuthRouter, TestRouter, WriteRouter


 @@ -2503,6 +2503,17 @@ class RouteForWriteTestCase(TestCase):
  self.assertEqual(e.model, Book)
  self.assertEqual(e.hints, {"instance": auth})

 +def test_order_with_respect_to(self):
 +q = Question.objects.using("other").create(text="The question")
 +a1 = Answer.objects.using("other").create(text="Answer 1",
 question=q)
 +a2 = Answer.objects.using("other").create(text="Answer 2",
 question=q)
 +a3 = Answer.objects.using("other").create(text="Answer 3",
 question=q)
 +q.set_answer_order([a1.pk, a2.pk, a3.pk], "other")
 +
 +a2.refresh_from_db()
 +self.assertIs(a2.get_next_in_order(), a3)
 +self.assertIs(a2.get_previous_in_order(), a1)
 +

  class NoRelationRouter:
  """Disallow all relations."""
 }}}

 Let's accept to investigate.

-- 
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/01070182c5d103c9-d616f1a9-fa48-4b13-b31a-27fffcd640f9-00%40eu-central-1.amazonses.com.


Re: [Django] #33945: get_previous_in_order and get_next_in_order return incorrect data when objects is stored in non-default database

2022-08-21 Thread Django
#33945: get_previous_in_order and get_next_in_order return incorrect data when
objects is stored in non-default database
-+-
 Reporter:  François Granade |Owner:  Wael
 |  Ramadan
 Type:  Bug  |   Status:  assigned
Component:  Database layer   |  Version:  4.0
  (models, ORM)  |
 Severity:  Normal   |   Resolution:
 Keywords:   | Triage Stage:
 |  Unreviewed
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Wael Ramadan):

 * cc: Wael Ramadan (added)
 * owner:  nobody => Wael Ramadan
 * status:  new => assigned


-- 
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/01070182c40874a4-9f05d5af-3996-4503-8782-7506afeb2aaf-00%40eu-central-1.amazonses.com.


[Django] #33945: get_previous_in_order and get_next_in_order return incorrect data when objects is stored in non-default database

2022-08-21 Thread Django
#33945: get_previous_in_order and get_next_in_order return incorrect data when
objects is stored in non-default database
-+-
   Reporter:  François   |  Owner:  nobody
  Granade|
   Type:  Bug| Status:  new
  Component:  Database   |Version:  4.0
  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  |
-+-
 Using the a simple model with an `order_with_respect_to` (slight variation
 of the models in
 https://github.com/django/django/blob/main/tests/multiple_database/models.py):

 {{{
 class Person(models.Model):
 name = models.CharField(max_length=100, unique=True)


 class Pet(models.Model):
 name = models.CharField(max_length=100)
 owner = models.ForeignKey(Person, models.CASCADE)

 class Meta:
 order_with_respect_to = "owner"

 }}}

 then adding some object, and declaring an order for the pets:

 {{{
  human = Person.objects.using("other").create(name="Human")
 dog = Pet.objects.using("other").create(name="Dog", owner=human)
 cat = Pet.objects.using("other").create(name="Cat", owner=human)
 duck = Pet.objects.using("other").create(name="Duck", owner=human)
 human.set_pet_order([duck.pk, dog.pk, cat.pk], "other")

 }}}

 Then simply trying to get the previous or next pet will fail:

 {{{
 >>> dog.get_next_in_order()  # would expect `cat`
 models.Pet.DoesNotExist: Pet matching query does not exist.
 >>> dog.get_previous_in_order()  # would expect `duck`
 models.Pet.DoesNotExist: Pet matching query does not exist.
 }}}

-- 
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/01070182c18ecd5d-f0d5641d-9e80-4cc4-aba5-bb242f0dcab7-00%40eu-central-1.amazonses.com.