Skip to content
Snippets Groups Projects
Commit 56d7a066 authored by Dorian Lesbre's avatar Dorian Lesbre
Browse files

Small changes

parent a50f26da
No related branches found
No related tags found
No related merge requests found
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},
......
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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment