1 from django import template
2 from ..models import Banner
3 from ..places import PLACES
6 register = template.Library()
9 @register.inclusion_tag('annoy/banner.html', takes_context=True)
10 def annoy_banner(context, place):
11 banners = Banner.choice(place, request=context['request'])
13 'banner': banners.first(),
14 'closable': PLACES.get(place, False),
17 @register.inclusion_tag('annoy/banner_blackout.html', takes_context=True)
18 def annoy_banner_blackout(context):
19 banners = Banner.choice('blackout', request=context['request'])
21 'banner': banners.first(),
26 @register.inclusion_tag('annoy/banners.html', takes_context=True)
27 def annoy_banners(context, place):
29 'banners': Banner.choice(place, request=context['request']),
30 'closable': PLACES.get(place, False),