diff --git a/djangoproject/templates/404.html b/djangoproject/templates/404.html index 885c594a3..1e421a896 100644 --- a/djangoproject/templates/404.html +++ b/djangoproject/templates/404.html @@ -1,9 +1,18 @@ {% extends 'base_error.html' %} -{% load i18n %} +{% load i18n docs %} {% block title %}{% translate "Page not found" %}{% endblock %} -{% block header %}
diff --git a/docs/templatetags/docs.py b/docs/templatetags/docs.py index 194a77e7f..1d54efb46 100644 --- a/docs/templatetags/docs.py +++ b/docs/templatetags/docs.py @@ -15,14 +15,23 @@ @register.inclusion_tag("docs/search_form.html", takes_context=True) def search_form(context): request = context["request"] + version = "" + lang = "" + exception = context.get("exception", "") + if exception: + lang = context["LANGUAGE_CODE"] + version = context["DOCS_VERSION"] + else: + version = context["version"] + lang = context["lang"] release = DocumentRelease.objects.get_by_version_and_lang( - context["version"], - context["lang"], + version, + lang, ) return { "form": DocSearchForm(request.GET, release=release), - "version": context["version"], - "lang": context["lang"], + "version": version, + "lang": lang, }