File tree Expand file tree Collapse file tree 4 files changed +18
-15
lines changed
Expand file tree Collapse file tree 4 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ class BlogFeed(Feed):
1414 description = "The latest news and views from Torchbox on the work we do, the web and the wider world"
1515
1616 def items (self ):
17- return BlogPage .objects .live ().order_by ("-date" )[:10 ]
17+ return BlogPage .objects .live ().public (). order_by ("-date" )[:10 ]
1818
1919 def item_title (self , item ):
2020 return item .title
Original file line number Diff line number Diff line change 1414from modelcluster .fields import ParentalManyToManyField
1515from tbx .core .blocks import StoryBlock
1616from tbx .core .utils .fields import StreamField
17- from tbx .core .utils .models import (
18- ColourThemeMixin ,
19- NavigationFields ,
20- SocialFields ,
21- )
17+ from tbx .core .utils .models import ColourThemeMixin , NavigationFields , SocialFields
2218from tbx .images .models import CustomImage
2319from tbx .people .models import ContactMixin
2420from tbx .taxonomy .models import Sector , Service
@@ -54,6 +50,7 @@ def blog_posts(self):
5450 # Get list of blog pages that are descendants of this page
5551 blog_posts = (
5652 BlogPage .objects .live ()
53+ .public ()
5754 .descendant_of (self )
5855 .distinct ()
5956 .prefetch_related (
Original file line number Diff line number Diff line change @@ -20,15 +20,15 @@ def get_googe_maps_key():
2020
2121@register .simple_tag
2222def get_next_sibling_by_order (page ):
23- sibling = page .get_next_siblings ().live ().first ()
23+ sibling = page .get_next_siblings ().live ().public (). first ()
2424
2525 if sibling :
2626 return sibling .specific
2727
2828
2929@register .simple_tag
3030def get_prev_sibling_by_order (page ):
31- sibling = page .get_prev_siblings ().live ().first ()
31+ sibling = page .get_prev_siblings ().live ().public (). first ()
3232
3333 if sibling :
3434 return sibling .specific
@@ -37,7 +37,11 @@ def get_prev_sibling_by_order(page):
3737@register .simple_tag
3838def get_next_sibling_blog (page ):
3939 sibling = (
40- BlogPage .objects .filter (date__lt = page .date ).order_by ("-date" ).live ().first ()
40+ BlogPage .objects .filter (date__lt = page .date )
41+ .order_by ("-date" )
42+ .live ()
43+ .public ()
44+ .first ()
4145 )
4246 if sibling :
4347 return sibling .specific
@@ -46,7 +50,11 @@ def get_next_sibling_blog(page):
4650@register .simple_tag
4751def get_prev_sibling_blog (page ):
4852 sibling = (
49- BlogPage .objects .filter (date__gt = page .date ).order_by ("-date" ).live ().last ()
53+ BlogPage .objects .filter (date__gt = page .date )
54+ .order_by ("-date" )
55+ .live ()
56+ .public ()
57+ .last ()
5058 )
5159 if sibling :
5260 return sibling .specific
Original file line number Diff line number Diff line change 1414from modelcluster .fields import ParentalManyToManyField
1515from tbx .core .blocks import StoryBlock
1616from tbx .core .utils .fields import StreamField
17- from tbx .core .utils .models import (
18- ColourThemeMixin ,
19- NavigationFields ,
20- SocialFields ,
21- )
17+ from tbx .core .utils .models import ColourThemeMixin , NavigationFields , SocialFields
2218from tbx .images .models import CustomImage
2319from tbx .people .models import ContactMixin
2420from tbx .taxonomy .models import Sector , Service
@@ -120,6 +116,7 @@ def related_works(self):
120116 Q (related_sectors__in = sectors ) | Q (related_services__in = services )
121117 )
122118 .live ()
119+ .public ()
123120 .distinct ()
124121 .order_by (F ("date" ).desc (nulls_last = True ))
125122 .exclude (pk = self .pk )[:4 ]
@@ -379,6 +376,7 @@ def works(self):
379376 pages = (
380377 self .get_children ()
381378 .live ()
379+ .public ()
382380 .type (HistoricalWorkPage , WorkPage )
383381 .specific ()
384382 .prefetch_related (
You can’t perform that action at this time.
0 commit comments