diff --git a/tests/queryset_pickle/models.py b/tests/queryset_pickle/models.py
index 77134a5..0424fdd 100644
|
a
|
b
|
class Container(object):
|
| 68 | 68 | |
| 69 | 69 | class M2MModel(models.Model): |
| 70 | 70 | groups = models.ManyToManyField(Group) |
| | 71 | |
| | 72 | |
| | 73 | class Book(models.Model): |
| | 74 | title = models.CharField(max_length=100) |
| | 75 | |
| | 76 | |
| | 77 | class Author(models.Model): |
| | 78 | name = models.CharField(max_length=100) |
| | 79 | books = models.ManyToManyField(Book, related_name='authors') |
| | 80 | |
| | 81 | |
| | 82 | class Category(models.Model): |
| | 83 | title = models.CharField(max_length=100) |
| | 84 | books = models.ManyToManyField(Book, related_name='categories') |
diff --git a/tests/queryset_pickle/tests.py b/tests/queryset_pickle/tests.py
index 5e42d90..15dab75 100644
|
a
|
b
|
from django.test import TestCase
|
| 8 | 8 | from django.utils.encoding import force_text |
| 9 | 9 | from django.utils.version import get_version |
| 10 | 10 | |
| 11 | | from .models import Container, Event, Group, Happening, M2MModel |
| | 11 | from .models import Author, Book, Category, Container, Event, Group, Happening, M2MModel |
| 12 | 12 | |
| 13 | 13 | |
| 14 | 14 | class PickleabilityTestCase(TestCase): |
| … |
… |
class PickleabilityTestCase(TestCase):
|
| 119 | 119 | groups = pickle.loads(pickle.dumps(groups)) |
| 120 | 120 | self.assertQuerysetEqual(groups, [g], lambda x: x) |
| 121 | 121 | |
| | 122 | def test_pickle_prefetch_related_with_m2m(self): |
| | 123 | author = Author.objects.create(name='John Doe') |
| | 124 | book = Book.objects.create(title='Adventures of Doe') |
| | 125 | book.authors.add(author) |
| | 126 | cat = Category.objects.create(title='Category') |
| | 127 | cat.books.add(book) |
| | 128 | |
| | 129 | Category.objects.all().delete() |
| | 130 | Author.objects.all().delete() |
| | 131 | Book.objects.all().delete() |
| | 132 | |
| | 133 | author = Author.objects.create(name='John Doe') |
| | 134 | book = Book.objects.create(title='Adventures of Doe') |
| | 135 | book.authors.add(author) |
| | 136 | cat = Category.objects.create(title='Category') |
| | 137 | cat.books.add(book) |
| | 138 | |
| | 139 | authors = Author.objects.prefetch_related('books__categories').all() |
| | 140 | pickle.loads(pickle.dumps(authors)) |
| | 141 | |
| 122 | 142 | def test_missing_django_version_unpickling(self): |
| 123 | 143 | """ |
| 124 | 144 | #21430 -- Verifies a warning is raised for querysets that are |