Compare commits
3 Commits
cf6f1b6d65
...
7794003791
Author | SHA1 | Date |
---|---|---|
|
7794003791 | |
|
49c30aab8f | |
|
524bd9d737 |
|
@ -0,0 +1,6 @@
|
|||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class BaseConfig(AppConfig):
|
||||
default_auto_field = "django.db.models.BigAutoField"
|
||||
name = "base"
|
|
@ -0,0 +1,51 @@
|
|||
# Generated by Django 5.0.6 on 2024-06-14 13:23
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
("wagtailcore", "0093_uploadedfile"),
|
||||
("wagtailimages", "0026_delete_uploadedimage"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name="SiteSettings",
|
||||
fields=[
|
||||
(
|
||||
"id",
|
||||
models.BigAutoField(
|
||||
auto_created=True,
|
||||
primary_key=True,
|
||||
serialize=False,
|
||||
verbose_name="ID",
|
||||
),
|
||||
),
|
||||
(
|
||||
"logo",
|
||||
models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="+",
|
||||
to="wagtailimages.image",
|
||||
),
|
||||
),
|
||||
(
|
||||
"site",
|
||||
models.OneToOneField(
|
||||
editable=False,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
to="wagtailcore.site",
|
||||
),
|
||||
),
|
||||
],
|
||||
options={
|
||||
"abstract": False,
|
||||
},
|
||||
),
|
||||
]
|
|
@ -0,0 +1,17 @@
|
|||
# Generated by Django 5.0.6 on 2024-06-14 13:46
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("base", "0001_initial"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="sitesettings",
|
||||
name="title",
|
||||
field=models.CharField(blank=True, max_length=32),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,20 @@
|
|||
from django.db import models
|
||||
from wagtail.admin.panels import FieldPanel
|
||||
from wagtail.contrib.settings.models import BaseSiteSetting, register_setting
|
||||
|
||||
|
||||
@register_setting
|
||||
class SiteSettings(BaseSiteSetting):
|
||||
title = models.CharField(max_length=32, blank=True)
|
||||
logo = models.ForeignKey(
|
||||
"wagtailimages.Image",
|
||||
on_delete=models.CASCADE,
|
||||
related_name="+",
|
||||
null=True,
|
||||
blank=True,
|
||||
)
|
||||
|
||||
panels = [
|
||||
FieldPanel("title"),
|
||||
FieldPanel("logo"),
|
||||
]
|
|
@ -24,10 +24,12 @@ BASE_DIR = os.path.dirname(PROJECT_DIR)
|
|||
# Application definition
|
||||
|
||||
INSTALLED_APPS = [
|
||||
"base",
|
||||
"home",
|
||||
"search",
|
||||
"wagtail.contrib.forms",
|
||||
"wagtail.contrib.redirects",
|
||||
"wagtail.contrib.settings",
|
||||
"wagtail.embeds",
|
||||
"wagtail.sites",
|
||||
"wagtail.users",
|
||||
|
@ -73,6 +75,7 @@ TEMPLATES = [
|
|||
"django.template.context_processors.request",
|
||||
"django.contrib.auth.context_processors.auth",
|
||||
"django.contrib.messages.context_processors.messages",
|
||||
"wagtail.contrib.settings.context_processors.settings",
|
||||
],
|
||||
},
|
||||
},
|
||||
|
@ -91,6 +94,8 @@ DATABASES = {
|
|||
}
|
||||
}
|
||||
|
||||
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
|
||||
|
||||
|
||||
# Password validation
|
||||
# https://docs.djangoproject.com/en/5.0/ref/settings/#auth-password-validators
|
||||
|
@ -189,3 +194,5 @@ WAGTAILDOCS_EXTENSIONS = [
|
|||
"xlsx",
|
||||
"zip",
|
||||
]
|
||||
|
||||
WAGTAILIMAGES_EXTENSIONS = ["gif", "jpg", "jpeg", "png", "webp", "svg"]
|
||||
|
|
|
@ -0,0 +1,18 @@
|
|||
:root {
|
||||
--pico-font-family: InterVariable, sans-serif;
|
||||
--pico-font-weight: 350;
|
||||
font-feature-settings: "ss01", "ss02", "ss03";
|
||||
}
|
||||
h1, h2, h3 {
|
||||
--pico-font-weight: 250;
|
||||
}
|
||||
h4, h5, h6 {
|
||||
--pico-font-weight: 700;
|
||||
}
|
||||
strong {
|
||||
--pico-font-weight: 550;
|
||||
}
|
||||
|
||||
nav img {
|
||||
height: 2rem;
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
{% load static wagtailcore_tags wagtailuserbar %}
|
||||
{% load static wagtailcore_tags wagtailimages_tags wagtailuserbar %}
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
|
@ -25,13 +25,16 @@
|
|||
<link rel="stylesheet" href="https://rsms.me/inter/inter.css">
|
||||
<link rel="preconnect" href="https://cdn.jsdelivr.net/">
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.fluid.classless.lime.min.css" />
|
||||
href="https://cdn.jsdelivr.net/npm/@picocss/pico@2/css/pico.lime.min.css" />
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'css/blog.css' %}">
|
||||
{% block extra_css %}{# Override this in templates to add extra stylesheets #}{% endblock %}
|
||||
{% image settings.base.SiteSettings.logo width-32 format-png preserve-svg as favicon %}
|
||||
<link rel="icon" href="{{ favicon.url }}">
|
||||
</head>
|
||||
<body>
|
||||
{% wagtailuserbar %}
|
||||
<main>
|
||||
{% include "nav.html" %}
|
||||
<main class="container">
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
{# Global javascript #}
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
{% load wagtailimages_tags %}
|
||||
<nav class="container">
|
||||
<ul>
|
||||
<li>{% srcset_image settings.base.SiteSettings.logo height-{32,64} format-png preserve-svg %}</li>
|
||||
{% if settings.base.SiteSettings.title %}
|
||||
<li>
|
||||
<a href="/">
|
||||
<strong>{{ settings.base.SiteSettings.title }}</strong>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<ul>
|
||||
<li>Lien</li>
|
||||
</ul>
|
||||
</nav>
|
|
@ -0,0 +1,25 @@
|
|||
# Generated by Django 5.0.6 on 2024-06-14 13:04
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("home", "0003_homepage_body_homepagelink"),
|
||||
("wagtailimages", "0026_delete_uploadedimage"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name="homepage",
|
||||
name="logo",
|
||||
field=models.ForeignKey(
|
||||
blank=True,
|
||||
null=True,
|
||||
on_delete=django.db.models.deletion.CASCADE,
|
||||
related_name="+",
|
||||
to="wagtailimages.image",
|
||||
),
|
||||
),
|
||||
]
|
|
@ -0,0 +1,16 @@
|
|||
# Generated by Django 5.0.6 on 2024-06-14 13:18
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("home", "0004_homepage_logo"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name="homepage",
|
||||
name="logo",
|
||||
),
|
||||
]
|
|
@ -0,0 +1,19 @@
|
|||
# Generated by Django 5.0.6 on 2024-06-14 13:24
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
dependencies = [
|
||||
("home", "0005_remove_homepage_logo"),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name="homepagelink",
|
||||
name="id",
|
||||
field=models.BigAutoField(
|
||||
auto_created=True, primary_key=True, serialize=False, verbose_name="ID"
|
||||
),
|
||||
),
|
||||
]
|
|
@ -10,7 +10,7 @@ class HomePage(Page):
|
|||
|
||||
content_panels = Page.content_panels + [
|
||||
FieldPanel("body"),
|
||||
InlinePanel("links"),
|
||||
InlinePanel("links", heading="Links", label="Link"),
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,17 @@
|
|||
{% extends "base.html" %}
|
||||
{% load wagtailcore_tags %}
|
||||
{% block content %}
|
||||
<h1>{{ page.title }}</h1>
|
||||
<section>
|
||||
{% for link in page.links.all %}<a href="{{ link.link }}"><article>{{ link.title }}</article></a>{% endfor %}
|
||||
{% if page.body %}
|
||||
<section>
|
||||
{{ page.body|richtext }}
|
||||
</section>
|
||||
{% endif %}
|
||||
<section class="grid">
|
||||
{% for link in page.links.all %}
|
||||
<a href="{{ link.link }}">
|
||||
<article>{{ link.title }}</article>
|
||||
</a>
|
||||
{% endfor %}
|
||||
</section>
|
||||
{% endblock content %}
|
||||
|
|
Loading…
Reference in New Issue