1 # -*- coding: utf-8 -*-
2 # This file is part of PrawoKultury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django import template
6 from events import app_settings
7 from events.models import Event
9 register = template.Library()
10 from datetime import datetime
13 @register.inclusion_tag('events/snippets/events_box.html', takes_context=True)
14 def events_box(context, limit=app_settings.BOX_LENGTH):
15 objects = Event.objects.filter(date__gte=datetime.now())[:limit]
16 return {'objects': objects}
19 @register.inclusion_tag('events/snippets/event_short.html')
20 def event_short(event):
21 return {'event': event}