Add editable info for footer and homepage
This commit is contained in:
parent
b1596dcdc8
commit
651a2b3682
12 changed files with 166 additions and 7 deletions
0
lps/base/__init__.py
Normal file
0
lps/base/__init__.py
Normal file
6
lps/base/apps.py
Normal file
6
lps/base/apps.py
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
from django.apps import AppConfig
|
||||||
|
|
||||||
|
|
||||||
|
class BaseConfig(AppConfig):
|
||||||
|
default_auto_field = "django.db.models.BigAutoField"
|
||||||
|
name = "base"
|
47
lps/base/migrations/0001_initial.py
Normal file
47
lps/base/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
# Generated by Django 5.0.6 on 2024-06-12 14:16
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
initial = True
|
||||||
|
|
||||||
|
dependencies = []
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name="NavigationSettings",
|
||||||
|
fields=[
|
||||||
|
(
|
||||||
|
"id",
|
||||||
|
models.BigAutoField(
|
||||||
|
auto_created=True,
|
||||||
|
primary_key=True,
|
||||||
|
serialize=False,
|
||||||
|
verbose_name="ID",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"address",
|
||||||
|
models.CharField(
|
||||||
|
blank=True, max_length=256, verbose_name="Adresse"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"phone",
|
||||||
|
models.CharField(
|
||||||
|
blank=True, max_length=16, verbose_name="Numéro de téléphone"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
(
|
||||||
|
"email",
|
||||||
|
models.EmailField(
|
||||||
|
blank=True, max_length=254, verbose_name="Adresse de courriel"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
"abstract": False,
|
||||||
|
},
|
||||||
|
),
|
||||||
|
]
|
19
lps/base/migrations/0002_alter_navigationsettings_phone.py
Normal file
19
lps/base/migrations/0002_alter_navigationsettings_phone.py
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
# Generated by Django 5.0.6 on 2024-06-12 14:18
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("base", "0001_initial"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name="navigationsettings",
|
||||||
|
name="phone",
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True, max_length=32, verbose_name="Numéro de téléphone"
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
0
lps/base/migrations/__init__.py
Normal file
0
lps/base/migrations/__init__.py
Normal file
23
lps/base/models.py
Normal file
23
lps/base/models.py
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
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",
|
||||||
|
)
|
||||||
|
]
|
|
@ -0,0 +1,33 @@
|
||||||
|
# Generated by Django 5.0.6 on 2024-06-12 14:24
|
||||||
|
|
||||||
|
import django.db.models.deletion
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
dependencies = [
|
||||||
|
("home", "0003_homepage_body"),
|
||||||
|
("wagtailimages", "0026_delete_uploadedimage"),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="homepage",
|
||||||
|
name="hero_text",
|
||||||
|
field=models.CharField(
|
||||||
|
blank=True, help_text="Phrase d'accueil", max_length=1024
|
||||||
|
),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name="homepage",
|
||||||
|
name="image",
|
||||||
|
field=models.ForeignKey(
|
||||||
|
blank=True,
|
||||||
|
help_text="Image page d'accueil",
|
||||||
|
null=True,
|
||||||
|
on_delete=django.db.models.deletion.SET_NULL,
|
||||||
|
related_name="+",
|
||||||
|
to="wagtailimages.image",
|
||||||
|
),
|
||||||
|
),
|
||||||
|
]
|
|
@ -1,11 +1,25 @@
|
||||||
|
from django.db import models
|
||||||
from wagtail.admin.panels import FieldPanel
|
from wagtail.admin.panels import FieldPanel
|
||||||
from wagtail.fields import RichTextField
|
from wagtail.fields import RichTextField
|
||||||
from wagtail.models import Page
|
from wagtail.models import Page
|
||||||
|
|
||||||
|
|
||||||
class HomePage(Page):
|
class HomePage(Page):
|
||||||
|
image = models.ForeignKey(
|
||||||
|
"wagtailimages.Image",
|
||||||
|
null=True,
|
||||||
|
blank=True,
|
||||||
|
on_delete=models.SET_NULL,
|
||||||
|
related_name="+",
|
||||||
|
help_text="Image page d'accueil",
|
||||||
|
)
|
||||||
|
hero_text = models.CharField(
|
||||||
|
blank=True, max_length=1024, help_text="Phrase d'accueil"
|
||||||
|
)
|
||||||
body = RichTextField(blank=True)
|
body = RichTextField(blank=True)
|
||||||
|
|
||||||
content_panels = Page.content_panels + [
|
content_panels = Page.content_panels + [
|
||||||
|
FieldPanel("image"),
|
||||||
|
FieldPanel("hero_text"),
|
||||||
FieldPanel("body"),
|
FieldPanel("body"),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
{% extends "base.html" %}
|
{% extends "base.html" %}
|
||||||
{% load wagtailcore_tags %}
|
{% load wagtailcore_tags wagtailimages_tags %}
|
||||||
{% block body_class %}template-homepage{% endblock %}
|
{% block body_class %}template-homepage{% endblock %}
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>Lycée du Pays de Soule</h1>
|
<h1>{{ page.title }}</h1>
|
||||||
<p>Formations générales, scientifiques et technologiques</p>
|
<section>
|
||||||
|
<p>{{ page.hero_text }}</p>
|
||||||
|
{% srcset_image page.image width-{510,700,950,1200,1450} %}
|
||||||
|
</section>
|
||||||
<hr>
|
<hr>
|
||||||
<section>
|
<section>
|
||||||
{{ page.body|richtext }}
|
{{ page.body|richtext }}
|
||||||
|
|
|
@ -24,10 +24,12 @@ BASE_DIR = os.path.dirname(PROJECT_DIR)
|
||||||
# Application definition
|
# Application definition
|
||||||
|
|
||||||
INSTALLED_APPS = [
|
INSTALLED_APPS = [
|
||||||
|
"base",
|
||||||
"home",
|
"home",
|
||||||
"search",
|
"search",
|
||||||
"wagtail.contrib.forms",
|
"wagtail.contrib.forms",
|
||||||
"wagtail.contrib.redirects",
|
"wagtail.contrib.redirects",
|
||||||
|
"wagtail.contrib.settings",
|
||||||
"wagtail.embeds",
|
"wagtail.embeds",
|
||||||
"wagtail.sites",
|
"wagtail.sites",
|
||||||
"wagtail.users",
|
"wagtail.users",
|
||||||
|
@ -73,6 +75,7 @@ TEMPLATES = [
|
||||||
"django.template.context_processors.request",
|
"django.template.context_processors.request",
|
||||||
"django.contrib.auth.context_processors.auth",
|
"django.contrib.auth.context_processors.auth",
|
||||||
"django.contrib.messages.context_processors.messages",
|
"django.contrib.messages.context_processors.messages",
|
||||||
|
"wagtail.contrib.settings.context_processors.settings",
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
@ -6,6 +6,6 @@ h1, h2, h3, h4, h5, h6 {
|
||||||
--pico-font-weight: 600;
|
--pico-font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
img.full-width {
|
img {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,17 @@
|
||||||
<hr>
|
<hr>
|
||||||
<section>
|
<section>
|
||||||
<p>
|
<nav>
|
||||||
Lycée du Pays de Soule – Avenue Jean Monnet, 64130 Chéraute – <a href="tel:+33559282228">+33 5 59 28 22 28</a> – <a href="mailto:ce.0641779L@ac-bordeaux.fr">ce.0641779L@ac-bordeaux.fr</a>
|
<ul>
|
||||||
</p>
|
<li>Lycée du Pays de Soule</li>
|
||||||
|
</ul>
|
||||||
|
<ul>
|
||||||
|
<li>{{ settings.base.NavigationSettings.address }}</li>
|
||||||
|
<li>
|
||||||
|
<a href="tel:{{ settings.base.NavigationSettings.phone }}">Téléphone</a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a href="mailto:{{ settings.base.NavigationSettings.email }}">Courriel</a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</nav>
|
||||||
</section>
|
</section>
|
||||||
|
|
Reference in a new issue