Refs #25361 -- Added test for pickling queryset of abstract-inherited models with Meta.ordering.
Fixed in 67cf5efa31
.
This commit is contained in:
parent
9285926295
commit
200cd8803d
|
@ -58,3 +58,17 @@ class Container:
|
||||||
|
|
||||||
class M2MModel(models.Model):
|
class M2MModel(models.Model):
|
||||||
groups = models.ManyToManyField(Group)
|
groups = models.ManyToManyField(Group)
|
||||||
|
|
||||||
|
|
||||||
|
class AbstractEvent(Event):
|
||||||
|
class Meta:
|
||||||
|
abstract = True
|
||||||
|
ordering = ['title']
|
||||||
|
|
||||||
|
|
||||||
|
class MyEvent(AbstractEvent):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class Edition(models.Model):
|
||||||
|
event = models.ForeignKey('MyEvent', on_delete=models.CASCADE)
|
||||||
|
|
|
@ -5,7 +5,7 @@ from django.db import models
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
from django.utils.version import get_version
|
from django.utils.version import get_version
|
||||||
|
|
||||||
from .models import Container, Event, Group, Happening, M2MModel
|
from .models import Container, Event, Group, Happening, M2MModel, MyEvent
|
||||||
|
|
||||||
|
|
||||||
class PickleabilityTestCase(TestCase):
|
class PickleabilityTestCase(TestCase):
|
||||||
|
@ -238,6 +238,12 @@ class PickleabilityTestCase(TestCase):
|
||||||
with self.assertRaisesMessage(RuntimeWarning, msg):
|
with self.assertRaisesMessage(RuntimeWarning, msg):
|
||||||
pickle.loads(pickle.dumps(qs))
|
pickle.loads(pickle.dumps(qs))
|
||||||
|
|
||||||
|
def test_order_by_model_with_abstract_inheritance_and_meta_ordering(self):
|
||||||
|
group = Group.objects.create(name='test')
|
||||||
|
event = MyEvent.objects.create(title='test event', group=group)
|
||||||
|
event.edition_set.create()
|
||||||
|
self.assert_pickles(event.edition_set.order_by('event'))
|
||||||
|
|
||||||
|
|
||||||
class InLookupTests(TestCase):
|
class InLookupTests(TestCase):
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue