Add updating navbar
This commit is contained in:
parent
651a2b3682
commit
180eb6dad7
3 changed files with 17 additions and 27 deletions
|
@ -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",
|
|
||||||
)
|
|
||||||
]
|
|
9
lps/base/templatetags/navigation_tags.py
Normal file
9
lps/base/templatetags/navigation_tags.py
Normal 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
|
|
@ -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>
|
||||||
|
|
Reference in a new issue