Skip to content
Snippets Groups Projects
views.py 713 B
Newer Older
Dorian Lesbre's avatar
Dorian Lesbre committed
from django.contrib.sitemaps import Sitemap
Dorian Lesbre's avatar
Dorian Lesbre committed
from django.shortcuts import render
Dorian Lesbre's avatar
Dorian Lesbre committed
from django.urls import reverse
Dorian Lesbre's avatar
Dorian Lesbre committed

Dorian Lesbre's avatar
Dorian Lesbre committed
from home.models import InterludesActivity

def static_view(request, slug):
	activities = InterludesActivity.objects.filter(display=True).order_by("title")
Dorian Lesbre's avatar
Dorian Lesbre committed
	return render(request, slug+'.html', {'slug': slug, 'activities': activities})
Dorian Lesbre's avatar
Dorian Lesbre committed


class StaticViewSitemap(Sitemap):
	changefreq = 'monthly'

	def items(self):
		return ["home", "inscription", "activites", "FAQ"]

	def location(self, item):
		return reverse(item)

	def priority(self, obj):
		# Priorize home page over the rest in search results
		if obj == "home" or obj == "":
				return 0.8
		else:
			return None # defaults to 0.5 when unset