Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ensure that Box content is rendered after update #2638

Merged
merged 1 commit into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion blogs/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,12 @@ def update_blog_supernav():
pass
else:
rendered_box = _render_blog_supernav(latest_entry)
box, _ = Box.objects.update_or_create(
box, created = Box.objects.update_or_create(
label='supernav-python-blog',
defaults={
'content': rendered_box,
'content_markup_type': 'html',
}
)
if not created:
box.save()
12 changes: 9 additions & 3 deletions downloads/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,13 +179,15 @@ def update_supernav():
'last_updated': timezone.now(),
})

box, _ = Box.objects.update_or_create(
box, created = Box.objects.update_or_create(
label='supernav-python-downloads',
defaults={
'content': content,
'content_markup_type': 'html',
}
)
if not created:
box.save()


def update_download_landing_sources_box():
Expand All @@ -208,13 +210,15 @@ def update_download_landing_sources_box():
return

source_content = render_to_string('downloads/download-sources-box.html', context)
source_box, _ = Box.objects.update_or_create(
source_box, created = Box.objects.update_or_create(
label='download-sources',
defaults={
'content': source_content,
'content_markup_type': 'html',
}
)
if not created:
source_box.save()


def update_homepage_download_box():
Expand All @@ -234,13 +238,15 @@ def update_homepage_download_box():

content = render_to_string('downloads/homepage-downloads-box.html', context)

box, _ = Box.objects.update_or_create(
box, created = Box.objects.update_or_create(
label='homepage-downloads',
defaults={
'content': content,
'content_markup_type': 'html',
}
)
if not created:
box.save()


@receiver(post_save, sender=Release)
Expand Down
4 changes: 3 additions & 1 deletion successstories/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,15 @@ def update_successstories_supernav(sender, instance, created, **kwargs):
'story': instance,
})

box, _ = Box.objects.update_or_create(
box, created = Box.objects.update_or_create(
label='supernav-python-success-stories',
defaults={
'content': content,
'content_markup_type': 'html',
}
)
if not created:
box.save()

# Purge Fastly cache
purge_url('/box/supernav-python-success-stories/')
Expand Down
Loading