returns content_types as a list instead of dict_values

pull/4852/head
Brady Moe 2018-10-16 14:22:23 -05:00 zatwierdzone przez Matt Westcott
rodzic 51ea37a403
commit 95333ba8ec
5 zmienionych plików z 14 dodań i 1 usunięć

Wyświetl plik

@ -5,6 +5,7 @@ Changelog
~~~~~~~~~~~~~~~~
* Added support for Python 3.7 (Matt Westcott)
* Fix: Query objects returned from `PageQuerySet.type_q` can now be merged with `|` (Brady Moe)
2.3 LTS (23.10.2018)

Wyświetl plik

@ -322,6 +322,7 @@ Contributors
* Meteor0id
* Naa Marteki Reed
* Jorge Barata
* Brady Moe
Translators
===========

Wyświetl plik

@ -20,6 +20,8 @@ Other features
Bug fixes
~~~~~~~~~
* Query objects returned from ``PageQuerySet.type_q`` can now be merged with ``|`` (Brady Moe)
Upgrade considerations
======================

Wyświetl plik

@ -178,7 +178,7 @@ class PageQuerySet(SearchableQuerySetMixin, TreeQuerySet):
if issubclass(model, klass)
]).values()
return Q(content_type__in=content_types)
return Q(content_type__in=list(content_types))
def type(self, model):
"""

Wyświetl plik

@ -1,4 +1,5 @@
from django.contrib.contenttypes.models import ContentType
from django.db.models import Q
from django.test import TestCase
from wagtail.core.models import Page, PageViewRestriction, Site
@ -397,6 +398,14 @@ class TestPageQuerySet(TestCase):
# Check that the event is in the results
self.assertTrue(pages.filter(id=event.id).exists())
def test_merge_queries(self):
type_q = Page.objects.type_q(EventPage)
query = Q()
query |= type_q
self.assertTrue(Page.objects.filter(query).exists())
class TestPageQueryInSite(TestCase):
fixtures = ['test.json']