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()
11 @register.inclusion_tag('polls/tags/poll.html', takes_context=True)
12 def poll(context, poll, show_results=True, redirect_to=''):
14 voted_already = poll.voted(context.get('request').session)
16 form = PollForm(poll=poll, initial=dict(redirect_to=redirect_to))
17 return dict(poll=poll,
19 voted_already=voted_already,
20 vote_count=poll.vote_count,
21 show_results=show_results,
22 request=context.get('request'),