1 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
2 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
4 from django import template
5 from django.core.cache import cache
6 from django.utils.safestring import mark_safe
7 from sponsors.models import SponsorPage
10 register = template.Library()
14 def sponsor_page(name):
15 key = 'sponsor_page:' + name
16 content = cache.get(key)
19 page = SponsorPage.objects.get(name=name)
20 except SponsorPage.DoesNotExist:
24 cache.set(key, content)
25 return mark_safe(content)