1 # -*- coding: utf-8 -*-
2 # This file is part of Wolnelektury, licensed under GNU Affero GPLv3 or later.
3 # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
5 from django import template
6 from ..forms import PollForm
9 register = template.Library()
12 @register.inclusion_tag('polls/tags/poll.html', takes_context=True)
13 def poll(context, poll, show_results=True, redirect_to=''):
15 voted_already = poll.voted(context.get('request').session)
17 form = PollForm(poll=poll, initial=dict(redirect_to=redirect_to))
18 return {'poll': poll, 'form': form, 'voted_already': voted_already, 'vote_count': poll.vote_count,
19 'show_results': show_results, 'request': context.get('request')}