diff --git a/concordia/admin/__init__.py b/concordia/admin/__init__.py index 03e154cbb..dd1fbf961 100644 --- a/concordia/admin/__init__.py +++ b/concordia/admin/__init__.py @@ -820,7 +820,7 @@ class SimplePageAdmin(admin.ModelAdmin): fieldsets = ( (None, {"fields": ("created_on", "updated_on", "path", "title")}), - ("Body", {"classes": ("markdown-preview",), "fields": ("navigation", "body")}), + ("Body", {"classes": ("markdown-preview",), "fields": ("body",)}), ) diff --git a/concordia/migrations/0094_remove_simplepage_navigation.py b/concordia/migrations/0094_remove_simplepage_navigation.py new file mode 100644 index 000000000..10cb86a75 --- /dev/null +++ b/concordia/migrations/0094_remove_simplepage_navigation.py @@ -0,0 +1,17 @@ +# Generated by Django 3.2.23 on 2024-02-02 19:31 + +from django.db import migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ("concordia", "0093_card_image_alt_text"), + ] + + operations = [ + migrations.RemoveField( + model_name="simplepage", + name="navigation", + ), + ] diff --git a/concordia/models.py b/concordia/models.py index 509a9246b..e2b03d774 100644 --- a/concordia/models.py +++ b/concordia/models.py @@ -757,7 +757,6 @@ class SimplePage(models.Model): title = models.CharField(max_length=200) - navigation = models.TextField(null=True) body = models.TextField() def __str__(self): diff --git a/concordia/templates/admin/concordia/simplepage/change_form.html b/concordia/templates/admin/concordia/simplepage/change_form.html index 536f13676..b6b130a3b 100644 --- a/concordia/templates/admin/concordia/simplepage/change_form.html +++ b/concordia/templates/admin/concordia/simplepage/change_form.html @@ -10,7 +10,6 @@ {{ block.super }} {% endblock content %} diff --git a/concordia/templates/static-page.html b/concordia/templates/static-page.html index baf9845d2..c91f1d021 100644 --- a/concordia/templates/static-page.html +++ b/concordia/templates/static-page.html @@ -19,10 +19,23 @@

{{ title }}

- {% if nav %} + {% if add_navigation %}
- {{ nav|safe }} - {{ body|safe }} + +
+ {{ body|safe }} +
{% else %} {{ body|safe }} diff --git a/concordia/views.py b/concordia/views.py index b1d5f2ded..807cd74a2 100644 --- a/concordia/views.py +++ b/concordia/views.py @@ -166,7 +166,6 @@ def simple_page(request, path=None): page = get_object_or_404(SimplePage, path=path) md = markdown.Markdown(extensions=["meta"]) - html = md.convert(page.body) breadcrumbs = [] path_components = request.path.strip("/").split("/") @@ -181,13 +180,18 @@ def simple_page(request, path=None): language_code = "es" ctx = { - "body": html, "language_code": language_code, "title": page.title, "breadcrumbs": breadcrumbs, } - if page.navigation is not None: - ctx["nav"] = md.convert(page.navigation) + + guides = Guide.objects.filter(title__iexact=page.title) + if guides.count() > 0: + html = guides.first().body + ctx["add_navigation"] = True + else: + html = page.body + ctx["body"] = md.convert(html) resp = render(request, "static-page.html", ctx) resp["Created"] = http_date(page.created_on.timestamp())