diff --git a/home/urls.py b/home/urls.py index ae31bcd5e0fa975388e5bc3dd63d9669cae1c203..21ef086dcd534939ed60c4fc6c82bbcdc0e5bd88 100644 --- a/home/urls.py +++ b/home/urls.py @@ -1,15 +1,16 @@ from django.contrib.sitemaps.views import sitemap from django.views.generic import RedirectView from django.urls import path, include -from . import views + +from home import views sitemaps = {"static_pages": views.StaticViewSitemap} urlpatterns = [ - path('', views.static_view, {"slug":"home"}, name = 'home'), - path('inscription/', views.static_view, {"slug":"inscription"}, name = 'inscription'), - path('activites/', views.static_view, {"slug":"activites"}, name = 'activites'), - path('faq/', views.static_view, {"slug":"faq"}, name = 'FAQ'), + path('', views.static_view, {"template": "home.html"}, name = 'home'), + path('inscription/', views.static_view, {"template":"inscription.html"}, name = 'inscription'), + path('activites/', views.static_view, {"template":"activites.html"}, name = 'activites'), + path('faq/', views.static_view, {"template":"faq.html"}, name = 'FAQ'), path('favicon.ico', RedirectView.as_view(url='/static/imgs/favicon.ico')), path( 'sitemap.xml', sitemap, {'sitemaps': sitemaps}, diff --git a/home/views.py b/home/views.py index 9fc11067dc71dd49686357a3b77bca8a9c326697..3c96bd85353d8e0dd0512d4c12fe73c412062ea5 100644 --- a/home/views.py +++ b/home/views.py @@ -1,15 +1,16 @@ from django.contrib.sitemaps import Sitemap -from django.shortcuts import render +from django.shortcuts import redirect, render from django.urls import reverse from home.models import InterludesActivity -def static_view(request, slug): +def static_view(request, template): + """Simple vues statique (rendu html)""" activities = InterludesActivity.objects.filter(display=True).order_by("title") - return render(request, slug+'.html', {'slug': slug, 'activities': activities}) - + return render(request, template, {'activities': activities}) class StaticViewSitemap(Sitemap): + """Vue générant la sitemap.xml du site""" changefreq = 'monthly' def items(self):