Archived
1
Fork 0

Add updating navbar

This commit is contained in:
Edgar P. Burkhart 2024-06-12 17:03:29 +02:00
parent 651a2b3682
commit 180eb6dad7
Signed by: edpibu
GPG key ID: 9833D3C5A25BD227
3 changed files with 17 additions and 27 deletions

View file

@ -1,23 +0,0 @@
from django.db import models
from wagtail.admin.panels import FieldPanel, MultiFieldPanel
from wagtail.contrib.settings.models import BaseGenericSetting, register_setting
@register_setting
class NavigationSettings(BaseGenericSetting):
address = models.CharField(max_length=256, verbose_name="Adresse", blank=True)
phone = models.CharField(
max_length=32, verbose_name="Numéro de téléphone", blank=True
)
email = models.EmailField(verbose_name="Adresse de courriel", blank=True)
panels = [
MultiFieldPanel(
[
FieldPanel("address"),
FieldPanel("phone"),
FieldPanel("email"),
],
"Informations de contact",
)
]

View file

@ -0,0 +1,9 @@
from django import template
from wagtail.models import Site
register = template.Library()
@register.simple_tag(takes_context=True)
def get_site_root(context):
return Site.find_for_request(context["request"]).root_page

View file

@ -1,15 +1,19 @@
{% load wagtailcore_tags navigation_tags %}
{% get_site_root as site_root %}
<nav> <nav>
<ul> <ul>
<li> <li>
<a href="{% pageurl site_root %}">
<strong>Lycée du Pays de Soule</strong> <strong>Lycée du Pays de Soule</strong>
</a>
</li> </li>
</ul> </ul>
<ul> <ul>
{% for menuitem in site_root.get_children.live.in_menu %}
<li> <li>
<a href="#">Blog</a> <a href="{% pageurl menuitem %}">{{ menuitem.title }}</a>
</li>
<li>
<a href="#">À propos</a>
</li> </li>
{% endfor %}
</ul> </ul>
</nav> </nav>