mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-04-30 19:44:48 +00:00
Prefetch root page in Site.find_for_request. Thanks to Yannick Chabbert for the suggestion!
This commit is contained in:
parent
2e970f88ea
commit
1d2ec402fa
2 changed files with 6 additions and 1 deletions
|
|
@ -121,6 +121,7 @@ Contributors
|
|||
* Danielle Madeley
|
||||
* Janneke Janssen
|
||||
* Roel Bruggink
|
||||
* Yannick Chabbert
|
||||
|
||||
Translators
|
||||
===========
|
||||
|
|
|
|||
|
|
@ -147,7 +147,11 @@ class Site(models.Model):
|
|||
default=MATCH_HOSTNAME,
|
||||
|
||||
output_field=IntegerField(),
|
||||
)).filter(Q(hostname=hostname) | Q(is_default_site=True)).order_by('match'))
|
||||
)).filter(Q(hostname=hostname) | Q(is_default_site=True)).order_by(
|
||||
'match'
|
||||
).select_related(
|
||||
'root_page'
|
||||
))
|
||||
|
||||
if sites:
|
||||
# if theres a unique match or hostname (with port or default) match
|
||||
|
|
|
|||
Loading…
Reference in a new issue