mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-05-22 22:05:50 +00:00
returns content_types as a list instead of dict_values
This commit is contained in:
parent
51ea37a403
commit
95333ba8ec
5 changed files with 14 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ Changelog
|
||||||
~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~
|
||||||
|
|
||||||
* Added support for Python 3.7 (Matt Westcott)
|
* 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)
|
2.3 LTS (23.10.2018)
|
||||||
|
|
|
||||||
|
|
@ -322,6 +322,7 @@ Contributors
|
||||||
* Meteor0id
|
* Meteor0id
|
||||||
* Naa Marteki Reed
|
* Naa Marteki Reed
|
||||||
* Jorge Barata
|
* Jorge Barata
|
||||||
|
* Brady Moe
|
||||||
|
|
||||||
Translators
|
Translators
|
||||||
===========
|
===========
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ Other features
|
||||||
Bug fixes
|
Bug fixes
|
||||||
~~~~~~~~~
|
~~~~~~~~~
|
||||||
|
|
||||||
|
* Query objects returned from ``PageQuerySet.type_q`` can now be merged with ``|`` (Brady Moe)
|
||||||
|
|
||||||
|
|
||||||
Upgrade considerations
|
Upgrade considerations
|
||||||
======================
|
======================
|
||||||
|
|
|
||||||
|
|
@ -178,7 +178,7 @@ class PageQuerySet(SearchableQuerySetMixin, TreeQuerySet):
|
||||||
if issubclass(model, klass)
|
if issubclass(model, klass)
|
||||||
]).values()
|
]).values()
|
||||||
|
|
||||||
return Q(content_type__in=content_types)
|
return Q(content_type__in=list(content_types))
|
||||||
|
|
||||||
def type(self, model):
|
def type(self, model):
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
from django.db.models import Q
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
from wagtail.core.models import Page, PageViewRestriction, Site
|
from wagtail.core.models import Page, PageViewRestriction, Site
|
||||||
|
|
@ -397,6 +398,14 @@ class TestPageQuerySet(TestCase):
|
||||||
# Check that the event is in the results
|
# Check that the event is in the results
|
||||||
self.assertTrue(pages.filter(id=event.id).exists())
|
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):
|
class TestPageQueryInSite(TestCase):
|
||||||
fixtures = ['test.json']
|
fixtures = ['test.json']
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue