feat: replace hardcoded navigation with CMS-managed models #33

Merged
mark merged 2 commits from feature/navigation-overhaul into main 2026-03-02 19:52:00 +00:00
3 changed files with 28 additions and 11 deletions
Showing only changes of commit d3687779a2 - Show all commits

View File

@@ -93,13 +93,6 @@ def seed_navigation_data(apps, schema_editor):
) )
def reverse_seed(apps, schema_editor):
NavigationMenuItem = apps.get_model("core", "NavigationMenuItem")
SocialMediaLink = apps.get_model("core", "SocialMediaLink")
NavigationMenuItem.objects.all().delete()
SocialMediaLink.objects.all().delete()
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
@@ -108,5 +101,5 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.RunPython(seed_navigation_data, reverse_seed), migrations.RunPython(seed_navigation_data, migrations.RunPython.noop),
] ]

View File

@@ -0,0 +1,23 @@
# Generated by Django 5.2.11 on 2026-03-02 19:35
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0003_seed_navigation_data'),
]
operations = [
migrations.AlterField(
model_name='navigationmenuitem',
name='link_url',
field=models.CharField(blank=True, default='', help_text='URL or path (used only when no page is selected).', max_length=500),
),
migrations.AlterField(
model_name='socialmedialink',
name='url',
field=models.CharField(help_text='URL or path (e.g. https://twitter.com/… or /feed/).', max_length=500),
),
]

View File

@@ -85,10 +85,11 @@ class NavigationMenuItem(Orderable):
related_name="+", related_name="+",
help_text="Link to an internal page. If unpublished, the link is hidden automatically.", help_text="Link to an internal page. If unpublished, the link is hidden automatically.",
) )
link_url = models.URLField( link_url = models.CharField(
max_length=500,
blank=True, blank=True,
default="", default="",
help_text="External URL (used only when no page is selected).", help_text="URL or path (used only when no page is selected).",
) )
link_title = models.CharField( link_title = models.CharField(
max_length=100, max_length=100,
@@ -144,7 +145,7 @@ class SocialMediaLink(Orderable):
max_length=30, max_length=30,
choices=SOCIAL_ICON_CHOICES, choices=SOCIAL_ICON_CHOICES,
) )
url = models.URLField() url = models.CharField(max_length=500, help_text="URL or path (e.g. https://twitter.com/… or /feed/).")
label = models.CharField( label = models.CharField(
max_length=100, max_length=100,
blank=True, blank=True,