-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1077 from ecds/feature/footer-menu
Footer menu migration and template
- Loading branch information
Showing
3 changed files
with
43 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Generated by Django 3.2.25 on 2024-09-19 20:35 | ||
|
||
from django.db import migrations | ||
|
||
|
||
def create_footer_menu(apps, schema_editor): | ||
""" | ||
Data migration to create a flat menu for the footer items. | ||
""" | ||
Site = apps.get_model("wagtailcore", "Site") | ||
FlatMenu = apps.get_model("wagtailmenus", "FlatMenu") | ||
try: | ||
site = Site.objects.get(is_default_site=True) | ||
except Site.DoesNotExist: | ||
site = Site.objects.first() | ||
try: | ||
FlatMenu.objects.get(handle="footer-menu") | ||
except FlatMenu.DoesNotExist: | ||
FlatMenu.objects.create( | ||
title="Footer menu", | ||
handle="footer-menu", | ||
max_levels=1, | ||
site=site, | ||
) | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("cms", "0005_homepage_featured_story"), | ||
] | ||
|
||
operations = [migrations.RunPython(create_footer_menu, migrations.RunPython.noop)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{% load menu_tags %} | ||
|
||
<div class="footer-links uk-flex uk-flex-column uk-flex-center"> | ||
{% for item in menu_items %} | ||
<a href="{{ item.href }}">{{ item.text }}</a> | ||
{% endfor %} | ||
</div> |