diff --git a/myhpi/core/context.py b/myhpi/core/context.py
index 8ed1a036..891e8016 100644
--- a/myhpi/core/context.py
+++ b/myhpi/core/context.py
@@ -15,6 +15,9 @@ def base_context(request):
if not root_page:
return {"root_page": None, "pages_by_parent": None}
+ # Determine the correct root for the active language
+ root_page = root_page.localized
+
# Determine all pages the user may view based on his groups
user_groups = get_user_groups(request.user)
diff --git a/myhpi/core/migrations/0008_remove_footer_column_4.py b/myhpi/core/migrations/0008_remove_footer_column_4.py
new file mode 100644
index 00000000..8cc1e849
--- /dev/null
+++ b/myhpi/core/migrations/0008_remove_footer_column_4.py
@@ -0,0 +1,16 @@
+# Generated by Django 4.0.7 on 2023-08-15 19:35
+
+from django.db import migrations
+
+
+class Migration(migrations.Migration):
+ dependencies = [
+ ("core", "0007_alter_footer_column_1_alter_footer_column_2_and_more"),
+ ]
+
+ operations = [
+ migrations.RemoveField(
+ model_name="footer",
+ name="column_4",
+ ),
+ ]
diff --git a/myhpi/core/models.py b/myhpi/core/models.py
index 67ae8bd0..34e529c6 100644
--- a/myhpi/core/models.py
+++ b/myhpi/core/models.py
@@ -223,13 +223,11 @@ class Footer(models.Model):
column_1 = CustomMarkdownField()
column_2 = CustomMarkdownField()
column_3 = CustomMarkdownField()
- column_4 = CustomMarkdownField()
panels = [
FieldPanel("column_1"),
FieldPanel("column_2"),
FieldPanel("column_3"),
- FieldPanel("column_4"),
]
def __str__(self):
@@ -240,7 +238,6 @@ def get_first_line(content):
get_first_line(self.column_1)
+ get_first_line(self.column_2)
+ get_first_line(self.column_3)
- + get_first_line(self.column_4)
)
diff --git a/myhpi/core/templatetags/core_extras.py b/myhpi/core/templatetags/core_extras.py
index 4139087d..e03f497c 100644
--- a/myhpi/core/templatetags/core_extras.py
+++ b/myhpi/core/templatetags/core_extras.py
@@ -30,9 +30,9 @@ def get_nav_children_for(pages_by_parent, parent_path):
@register.inclusion_tag("footer.html")
-def insert_footer():
+def insert_footer(page):
footer = Footer.objects.first()
- return {"footer_columns": [footer.column_1, footer.column_2, footer.column_3, footer.column_4]}
+ return {"footer_columns": [footer.column_1, footer.column_2, footer.column_3], "page": page}
@register.filter(name="tag_external_links")
diff --git a/myhpi/templates/base.html b/myhpi/templates/base.html
index 045e47f5..a150d676 100644
--- a/myhpi/templates/base.html
+++ b/myhpi/templates/base.html
@@ -165,7 +165,7 @@
- {% insert_footer %}
+ {% insert_footer page %}
{# Global javascript #}
diff --git a/myhpi/templates/footer.html b/myhpi/templates/footer.html
index b960b4b0..0f10570c 100644
--- a/myhpi/templates/footer.html
+++ b/myhpi/templates/footer.html
@@ -1,3 +1,4 @@
+{% load i18n %}
{% load core_extras %}
\ No newline at end of file
diff --git a/myhpi/tests/core/setup.py b/myhpi/tests/core/setup.py
index e7c98de3..eb0eb575 100644
--- a/myhpi/tests/core/setup.py
+++ b/myhpi/tests/core/setup.py
@@ -67,7 +67,6 @@ def create_basic_page_structure():
column_1="# Fachschaft\r\n",
column_2="# Rechtliches\r\n\r\n- [Impressum]()\r\n- [Datenschutzerklärung]()",
column_3="# Entwicklung\r\n\r\n- [GitHub](https://github.com/fsr-de/myHPI/)",
- column_4="# Sprache\r\n",
).save()
# Remove dummy site
Site.objects.all()[0].delete()