Skip to content

Commit 17f46d1

Browse files
kushvah-ajaysingh-nagarroshubhamgoel02root
authored
home page banner list issue fix (#1769)
Co-authored-by: Shubham Goel <130149461+shubhamgoel02@users.noreply.github.com> Co-authored-by: root <root@IN-CKN2GK3>
1 parent f44acc0 commit 17f46d1

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

home/wagtail_hooks.py

+12-1
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
from wagtail.models import Page, PageViewRestriction
1818

1919
from home.models import (BannerIndexPage, FooterIndexPage, LocaleDetail,
20-
Section, SectionIndexPage)
20+
Section, SectionIndexPage, BannerPage, HomePageBanner, HomePage)
2121
from home.translatable_strings import translatable_strings
2222
from translation_manager.models import TranslationEntry
23+
from wagtail.core.signals import page_published
24+
from django.dispatch import receiver
2325

2426

2527
@hooks.register('before_serve_page', order=-1)
@@ -214,3 +216,12 @@ def hide_add_article_button():
214216
Inject custom CSS to hide the "Add Article" button in the Wagtail admin.
215217
"""
216218
return format_html('<link rel="stylesheet" href="/static/css/custom_admin.css">')
219+
220+
221+
@receiver(page_published, sender=BannerPage)
222+
def create_home_page_banner(sender, instance, **kwargs):
223+
"""Ensure a HomePageBanner entry is created after a BannerPage is published."""
224+
parent = instance.get_parent().specific
225+
parent = parent.get_parent().specific
226+
if parent:
227+
HomePageBanner.objects.get_or_create(source=parent, banner_page=instance)

iogt/settings/production.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
},
3434
}
3535

36-
SITE_VERSION = '3.0.1'
36+
SITE_VERSION = '3.0.2'
3737

3838
try:
3939
from .local import *

0 commit comments

Comments
 (0)