Skip to content

Deploy last remaining changes from Codeando - #114

Merged
dakotabenjamin merged 7 commits into
mainfrom
staging
Aug 18, 2026
Merged

Deploy last remaining changes from Codeando#114
dakotabenjamin merged 7 commits into
mainfrom
staging

Conversation

@dakotabenjamin

Copy link
Copy Markdown
Member

No description provided.

Comment thread home/templatetags/homepage_tags.py Outdated

@register.simple_tag(takes_context=True)
def get_search_page(context):
return SearchPage.objects.live().filter(locale=context['page'].locale).first().specific

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need a guard here.
This assumes context['page'] exists, but we get a 500 error if it doesn't.

All pages must have a locale set e.g. /en. Loading the page without that means that the page context doesn't exist, hence error 👍

We should also guard the .first usage here. An improvement would be:

  @register.simple_tag(takes_context=True)
  def get_search_page(context):
      page = context.get("page")
      if page is None:
          return None
      search_page = SearchPage.objects.live().filter(locale=page.locale).first()
      return search_page.specific if search_page else None

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it was the redirects on production that result in this error, and meant it didn't show during local tests? Good job we have a staging env now, ey!

@dakotabenjamin
dakotabenjamin merged commit c1ad41f into main Aug 18, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants