kopia lustrzana https://github.com/wagtail/wagtail
returns content_types as a list instead of dict_values
rodzic
51ea37a403
commit
95333ba8ec
|
@ -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)
|
||||
|
|
|
@ -322,6 +322,7 @@ Contributors
|
|||
* Meteor0id
|
||||
* Naa Marteki Reed
|
||||
* Jorge Barata
|
||||
* Brady Moe
|
||||
|
||||
Translators
|
||||
===========
|
||||
|
|
|
@ -20,6 +20,8 @@ Other features
|
|||
Bug fixes
|
||||
~~~~~~~~~
|
||||
|
||||
* Query objects returned from ``PageQuerySet.type_q`` can now be merged with ``|`` (Brady Moe)
|
||||
|
||||
|
||||
Upgrade considerations
|
||||
======================
|
||||
|
|
|
@ -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):
|
||||
"""
|
||||
|
|
|
@ -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']
|
||||
|
|
Ładowanie…
Reference in New Issue