From e172c3e2e2322ce816f35a0916895cb48cde103d Mon Sep 17 00:00:00 2001 From: Klafyvel Date: Sat, 20 Jan 2018 23:14:11 +0100 Subject: [PATCH] =?UTF-8?q?D=C3=A9but=20d'affichage.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- site_tps/urls.py | 3 +++ site_tps/views.py | 10 ++++++++++ templates/base.html | 16 ++++++++++++++++ templates/home.html | 7 +++++++ templates/nav_bar.html | 8 ++++++++ 5 files changed, 44 insertions(+) create mode 100644 site_tps/views.py create mode 100644 templates/home.html create mode 100644 templates/nav_bar.html diff --git a/site_tps/urls.py b/site_tps/urls.py index 997c293..dd0d9e5 100644 --- a/site_tps/urls.py +++ b/site_tps/urls.py @@ -16,6 +16,9 @@ Including another URLconf from django.contrib import admin from django.urls import path +from . import views + urlpatterns = [ path('admin/', admin.site.urls), + path('', views.home), ] diff --git a/site_tps/views.py b/site_tps/views.py new file mode 100644 index 0000000..a90820c --- /dev/null +++ b/site_tps/views.py @@ -0,0 +1,10 @@ +from django.shortcuts import render +from settings.models import SiteSettings + + +def home(request): + settings, _created = SiteSettings.objects.get_or_create() + return render(request, "home.html", { + 'upload_allowed': settings.allow_upload, + 'message': settings.home_message, + }) diff --git a/templates/base.html b/templates/base.html index e69de29..7d2ac97 100644 --- a/templates/base.html +++ b/templates/base.html @@ -0,0 +1,16 @@ + + + + + NOM DE SITE + + + + + {% include 'nav_bar.html' %} + {% block content %}{% endblock %} + + + + + diff --git a/templates/home.html b/templates/home.html new file mode 100644 index 0000000..5d33ec9 --- /dev/null +++ b/templates/home.html @@ -0,0 +1,7 @@ +{% extends 'base.html'%} +{% block content %} +

{{message|safe}}

+{% if not upload_allowed %} +

Les envois de contenu ne sont pas autorisés actuellement.

+{% endif %} +{% endblock %} diff --git a/templates/nav_bar.html b/templates/nav_bar.html new file mode 100644 index 0000000..54d5ddd --- /dev/null +++ b/templates/nav_bar.html @@ -0,0 +1,8 @@ +