Automated merge with ssh://openslides.org/openslides
This commit is contained in:
commit
1dc631d82d
@ -28,10 +28,13 @@ def _bootstrap():
|
|||||||
ui = hgui.ui()
|
ui = hgui.ui()
|
||||||
repository = localrepository(ui, join(conts, '..'))
|
repository = localrepository(ui, join(conts, '..'))
|
||||||
#repository = localrepository(ui, conts)
|
#repository = localrepository(ui, conts)
|
||||||
ctx = repository['tip']
|
ctx = repository['.']
|
||||||
revision = '%(num)s:%(id)s' % {
|
if ctx.tags() and ctx.tags() != ['tip']:
|
||||||
'num': ctx.rev(), 'id': shorthex(ctx.node())
|
revision = ' '.join(ctx.tags())
|
||||||
}
|
else:
|
||||||
|
revision = '%(num)s:%(id)s' % {
|
||||||
|
'num': ctx.rev(), 'id': shorthex(ctx.node())
|
||||||
|
}
|
||||||
except TypeError:
|
except TypeError:
|
||||||
revision = 'unknown'
|
revision = 'unknown'
|
||||||
except RepoError:
|
except RepoError:
|
||||||
|
@ -30,9 +30,9 @@
|
|||||||
<img src="/static/images/icons/voting-yes.png" title="{% trans 'Yes' %}"> {{ option.yes }} <br>
|
<img src="/static/images/icons/voting-yes.png" title="{% trans 'Yes' %}"> {{ option.yes }} <br>
|
||||||
<img src="/static/images/icons/voting-no.png" title="{% trans 'No' %}"> {{ option.no }} <br>
|
<img src="/static/images/icons/voting-no.png" title="{% trans 'No' %}"> {{ option.no }} <br>
|
||||||
<img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {{ option.undesided }}<br>
|
<img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {{ option.undesided }}<br>
|
||||||
<img src="/static/images/icons/voting-invalid.png" title="{% trans 'Invalid' %}"> {{ p.votesinvalid }}<br>
|
<img src="/static/images/icons/voting-invalid.png" title="{% trans 'Invalid' %}"> {{ p.votesinvalidf }}<br>
|
||||||
<div style="border-top: 1px solid; padding-top: 5px; margin: 5px 0; width: 5em;">
|
<div style="border-top: 1px solid; padding-top: 5px; margin: 5px 0; width: 10em;">
|
||||||
<img src="/static/images/icons/voting-total.png" title="{% trans 'Votes cast' %}"> {{ p.votescast }}
|
<img src="/static/images/icons/voting-total.png" title="{% trans 'Votes cast' %}"> {{ p.votescastf }}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
<br>
|
<br>
|
||||||
@ -46,7 +46,7 @@
|
|||||||
{% endwith %}
|
{% endwith %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<h1>{% trans "Application No." %} {{ item.application.number }}</h1>
|
<h1>{% trans "Application No." %} {{ item.application.number }}</h1>
|
||||||
<b>{{ item.title }}</b>
|
<b>{{ item.title }}</b>
|
||||||
<p>
|
<p>
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
<p>
|
<p>
|
||||||
<div class="text">{{ item.assignment.description|linebreaks }}</div>
|
<div class="text">{{ item.assignment.description|linebreaks }}</div>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{% if item.assignment.status != "fin" %}
|
{% if item.assignment.status != "fin" %}
|
||||||
<h3>{% trans "Candidates" %}</h3>
|
<h3>{% trans "Candidates" %}</h3>
|
||||||
<ol>
|
<ol>
|
||||||
@ -34,7 +34,7 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ol>
|
</ol>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% with polls|first as firstpoll %}
|
{% with polls|first as firstpoll %}
|
||||||
{% if polls.count > 0 and firstpoll.published %}
|
{% if polls.count > 0 and firstpoll.published %}
|
||||||
|
|
||||||
@ -72,7 +72,7 @@
|
|||||||
{% else %}∅{% endif %}
|
{% else %}∅{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<tr>
|
<tr>
|
||||||
<td {% if item.assignment.profile.exist %}colspan="2"{% endif %}><i>{% trans "No ballots available." %}</i></td>
|
<td {% if item.assignment.profile.exist %}colspan="2"{% endif %}><i>{% trans "No ballots available." %}</i></td>
|
||||||
@ -82,7 +82,7 @@
|
|||||||
<td>{%trans 'Invalid votes' %}</td>
|
<td>{%trans 'Invalid votes' %}</td>
|
||||||
{% for p in polls %}
|
{% for p in polls %}
|
||||||
{% if p.published %}
|
{% if p.published %}
|
||||||
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-invalid.png" title="{% trans 'Invalid' %}"> {{ p.votesinvalid }}</td>
|
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-invalid.png" title="{% trans 'Invalid' %}"> {{ p.votesinvalidf }}</td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
@ -90,13 +90,13 @@
|
|||||||
<td><b>{%trans 'Votes cast' %}</b></td>
|
<td><b>{%trans 'Votes cast' %}</b></td>
|
||||||
{% for p in polls %}
|
{% for p in polls %}
|
||||||
{% if p.published %}
|
{% if p.published %}
|
||||||
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-total.png" title="{% trans 'Votes cast' %}"> <b>{{ p.votescast }}</b></td>
|
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-total.png" title="{% trans 'Votes cast' %}"> <b>{{ p.votescastf }}</b></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
<h3>{{ poll.application.title }}</h3>
|
<h3>{{ poll.application.title }}</h3>
|
||||||
|
|
||||||
<p>{%trans "Results of" %} {{ ballot }}. {%trans "Vote" %}</p>
|
<p>{%trans "Results of" %} {{ ballot }}. {%trans "Vote" %}</p>
|
||||||
|
<i>-1 := {% trans 'majority' %}, -2 := {% trans 'undocumented' %}</i>
|
||||||
<form action="" method="post">{% csrf_token %}
|
<form action="" method="post">{% csrf_token %}
|
||||||
<table class="table" style="width: auto;">
|
<table class="table" style="width: auto;">
|
||||||
<tr>
|
<tr>
|
||||||
@ -57,6 +57,6 @@
|
|||||||
<span class="icon cancel">{%trans 'Cancel' %}</span>
|
<span class="icon cancel">{%trans 'Cancel' %}</span>
|
||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
@ -74,9 +74,9 @@
|
|||||||
<img src="/static/images/icons/voting-yes.png" title="{% trans 'Yes' %}"> {{ option.yes }}<br>
|
<img src="/static/images/icons/voting-yes.png" title="{% trans 'Yes' %}"> {{ option.yes }}<br>
|
||||||
<img src="/static/images/icons/voting-no.png" title="{% trans 'No' %}"> {{ option.no }}<br>
|
<img src="/static/images/icons/voting-no.png" title="{% trans 'No' %}"> {{ option.no }}<br>
|
||||||
<img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {{ option.undesided }}<br>
|
<img src="/static/images/icons/voting-abstention.png" title="{% trans 'Abstention' %}"> {{ option.undesided }}<br>
|
||||||
<img src="/static/images/icons/voting-invalid.png" title="{% trans 'Invalid' %}"> {{ poll.votesinvalid }}<br>
|
<img src="/static/images/icons/voting-invalid.png" title="{% trans 'Invalid' %}"> {{ poll.votesinvalidf }}<br>
|
||||||
<div style="border-top: 1px solid; padding-top: 5px; margin: 5px 0; width: 5em;">
|
<div style="border-top: 1px solid; padding-top: 5px; margin: 5px 0; width: 10em;">
|
||||||
<img src="/static/images/icons/voting-total.png" title="{% trans 'Votes cast' %}"> {{ poll.votescast }}
|
<img src="/static/images/icons/voting-total.png" title="{% trans 'Votes cast' %}"> {{ poll.votescastf }}
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if perms.application.can_manage_application %}
|
{% if perms.application.can_manage_application %}
|
||||||
|
@ -145,7 +145,7 @@ def edit(request, application_id=None):
|
|||||||
except Profile.DoesNotExist:
|
except Profile.DoesNotExist:
|
||||||
pass
|
pass
|
||||||
if len(supporters_added) > 0:
|
if len(supporters_added) > 0:
|
||||||
log_added = _(", ".join(supporters_added))
|
log_added = ", ".join(supporters_added)
|
||||||
application.writelog(_("Supporter: +%s") % log_added, request.user)
|
application.writelog(_("Supporter: +%s") % log_added, request.user)
|
||||||
# log removed supporters
|
# log removed supporters
|
||||||
supporters_removed = []
|
supporters_removed = []
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
{% blocktrans count counter=options|length %}candidate{% plural %}candidates{% endblocktrans %}
|
{% blocktrans count counter=options|length %}candidate{% plural %}candidates{% endblocktrans %}
|
||||||
</p>
|
</p>
|
||||||
<p><b>{% trans "Short description" %}:</b> {{ poll.description }}</p>
|
<p><b>{% trans "Short description" %}:</b> {{ poll.description }}</p>
|
||||||
|
<i>-1 := {% trans 'majority' %}, -2 := {% trans 'undocumented' %}</i>
|
||||||
<form action="" method="post">{% csrf_token %}
|
<form action="" method="post">{% csrf_token %}
|
||||||
<table class="table" style="width:auto;">
|
<table class="table" style="width:auto;">
|
||||||
<tr>
|
<tr>
|
||||||
@ -41,7 +42,7 @@
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<a href='{% url print_assignment_poll poll.id %}'>
|
<a href='{% url print_assignment_poll poll.id %}'>
|
||||||
<button type="button">
|
<button type="button">
|
||||||
@ -49,7 +50,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p>
|
<p>
|
||||||
<button type="submit">
|
<button type="submit">
|
||||||
<span class="icon ok">{%trans 'Save' %}</span>
|
<span class="icon ok">{%trans 'Save' %}</span>
|
||||||
|
@ -125,22 +125,24 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<th>{% trans "Candidates" %}</th>
|
<th>{% trans "Candidates" %}</th>
|
||||||
{% for poll in assignment.poll_set.all %}
|
{% for poll in assignment.poll_set.all %}
|
||||||
|
{% if poll.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %}
|
||||||
<th style="vertical-align: top; white-space:nowrap;">{% if perms.assignment.can_manage_assignment %}<a href="{% url assignment_poll_view poll.id %}">{% endif %}
|
<th style="vertical-align: top; white-space:nowrap;">{% if perms.assignment.can_manage_assignment %}<a href="{% url assignment_poll_view poll.id %}">{% endif %}
|
||||||
{{ forloop.counter }}. {% trans 'ballot' %}
|
{{ forloop.counter }}. {% trans 'ballot' %}
|
||||||
{% if perms.assignment.can_manage_assignment %}
|
{% if perms.assignment.can_manage_assignment %}
|
||||||
</a>
|
</a>
|
||||||
{% if poll.published %}
|
{% if poll.published %}
|
||||||
<a href={% url assignment_poll_notpublish poll.id %}><img
|
<a href={% url assignment_poll_notpublish poll.id %}><img
|
||||||
src="/static/images/icons/user-online.png"
|
src="/static/images/icons/user-online.png"
|
||||||
title="{% trans 'Unpublish results' %}"></a>
|
title="{% trans 'Unpublish results' %}"></a>
|
||||||
{% else %}
|
{% else %}
|
||||||
<a href={% url assignment_poll_publish poll.id %}><img
|
<a href={% url assignment_poll_publish poll.id %}><img
|
||||||
src="/static/images/icons/user-offline.png"
|
src="/static/images/icons/user-offline.png"
|
||||||
title="{% trans 'Publish results' %}"></a>
|
title="{% trans 'Publish results' %}"></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{% url assignment_poll_delete poll.id %}"><img src="/static/images/icons/edit-delete.png" title="{% trans 'Delete Poll' %}"></a>
|
<a href="{% url assignment_poll_delete poll.id %}"><img src="/static/images/icons/edit-delete.png" title="{% trans 'Delete Poll' %}"></a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</th>
|
</th>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
||||||
<th>
|
<th>
|
||||||
@ -184,7 +186,7 @@
|
|||||||
{% else %}∅{% endif %}
|
{% else %}∅{% endif %}
|
||||||
</td>
|
</td>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
||||||
<td></td>
|
<td></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
@ -192,18 +194,22 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{%trans 'Invalid votes' %}</td>
|
<td>{%trans 'Invalid votes' %}</td>
|
||||||
{% for p in polls %}
|
{% for p in polls %}
|
||||||
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-invalid.png" title="{% trans 'Invalid' %}"> {{ p.votesinvalid }}</td>
|
{% if p.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %}
|
||||||
|
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-invalid.png" title="{% trans 'Invalid' %}"> {{ p.votesinvalidf }}</td>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
||||||
<td></td>
|
<td></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
<tr class="total">
|
<tr class="total">
|
||||||
<td><b>{%trans 'Votes cast' %}</b></td>
|
<td><b>{%trans 'Votes cast' %}</b></td>
|
||||||
{% for p in polls %}
|
{% for p in polls %}
|
||||||
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-total.png" title="{% trans 'Votes cast' %}"> <b>{{ p.votescast }}</b></td>
|
{% if p.published and not perms.assignment.can_manage_assignment or perms.assignment.can_manage_assignment %}
|
||||||
|
<td style="white-space:nowrap;"><img src="/static/images/icons/voting-total.png" title="{% trans 'Votes cast' %}"> <b>{{ p.votescastf }}</b></td>
|
||||||
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% if assignment.profile.count > 0 and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
{% if assignment.profile.exists and perms.assignment.can_manage_assignment and assignment.status == "vot" %}
|
||||||
<td></td>
|
<td></td>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -69,14 +69,15 @@ def view(request, assignment_id=None):
|
|||||||
for candidate in assignment.candidates:
|
for candidate in assignment.candidates:
|
||||||
tmplist = [[candidate, assignment.is_elected(candidate)], []]
|
tmplist = [[candidate, assignment.is_elected(candidate)], []]
|
||||||
for poll in assignment.poll_set.all():
|
for poll in assignment.poll_set.all():
|
||||||
if candidate in poll.options_values:
|
if (poll.published and not request.user.has_perm('assignment.can_manage_assignment')) or request.user.has_perm('assignment.can_manage_assignment'):
|
||||||
option = Option.objects.filter(poll=poll).filter(user=candidate)[0]
|
if candidate in poll.options_values:
|
||||||
if poll.optiondecision:
|
option = Option.objects.filter(poll=poll).filter(user=candidate)[0]
|
||||||
tmplist[1].append([option.yes, option.no, option.undesided])
|
if poll.optiondecision:
|
||||||
|
tmplist[1].append([option.yes, option.no, option.undesided])
|
||||||
|
else:
|
||||||
|
tmplist[1].append(option.yes)
|
||||||
else:
|
else:
|
||||||
tmplist[1].append(option.yes)
|
tmplist[1].append("-")
|
||||||
else:
|
|
||||||
tmplist[1].append("-")
|
|
||||||
votes.append(tmplist)
|
votes.append(tmplist)
|
||||||
|
|
||||||
polls = []
|
polls = []
|
||||||
@ -238,7 +239,6 @@ def poll_view(request, poll_id):
|
|||||||
def set_published(request, poll_id, published=True):
|
def set_published(request, poll_id, published=True):
|
||||||
try:
|
try:
|
||||||
poll = Poll.objects.get(pk=poll_id)
|
poll = Poll.objects.get(pk=poll_id)
|
||||||
print poll.published
|
|
||||||
poll.set_published(published)
|
poll.set_published(published)
|
||||||
if poll.published:
|
if poll.published:
|
||||||
messages.success(request, _("Poll successfully set to published.") )
|
messages.success(request, _("Poll successfully set to published.") )
|
||||||
@ -246,7 +246,7 @@ def set_published(request, poll_id, published=True):
|
|||||||
messages.success(request, _("Poll successfully set to unpublished.") )
|
messages.success(request, _("Poll successfully set to unpublished.") )
|
||||||
except Poll.DoesNotExist:
|
except Poll.DoesNotExist:
|
||||||
messages.error(request, _('Poll ID %d does not exist.') % int(poll_id))
|
messages.error(request, _('Poll ID %d does not exist.') % int(poll_id))
|
||||||
return redirect(reverse('assignment_view', args=[poll.id]))
|
return redirect(reverse('assignment_view', args=[poll.assignment.id]))
|
||||||
|
|
||||||
@permission_required('assignment.can_manage_assignment')
|
@permission_required('assignment.can_manage_assignment')
|
||||||
def delete_poll(request, poll_id):
|
def delete_poll(request, poll_id):
|
||||||
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@ -4,32 +4,33 @@
|
|||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>{% trans "Participants" %}</h1>
|
<h1>{% trans "Participants" %}</h1>
|
||||||
|
|
||||||
<p><form action="{{request.url}}" name="filter" method="get">
|
<p><form action="{{request.url}}" name="filter" method="post">
|
||||||
|
{% csrf_token %}
|
||||||
{%trans "Filter" %}:
|
{%trans "Filter" %}:
|
||||||
<select class="default-input" name="gender" onchange="document.forms['filter'].submit()">
|
<select class="default-input" name="gender" onchange="document.forms['filter'].submit()">
|
||||||
<option value="---">-- {%trans "Gender" %}--</option>
|
<option value="---">-- {%trans "Gender" %}--</option>
|
||||||
<option value="male" {% if 'male' in request.GET.gender %}selected{% endif %}>{%trans "Male" %}</option>
|
<option value="male" {% if 'male' in sortfilter.gender %}selected{% endif %}>{%trans "Male" %}</option>
|
||||||
<option value="female" {% if 'female' in request.GET.gender %}selected{% endif %}>{%trans "Female" %}</option>
|
<option value="female" {% if 'female' in sortfilter.gender %}selected{% endif %}>{%trans "Female" %}</option>
|
||||||
<option value="none" {% if 'none' in request.GET.gender %}selected{% endif %}>{%trans "Not specified" %}</option>
|
<option value="none" {% if 'none' in sortfilter.gender %}selected{% endif %}>{%trans "Not specified" %}</option>
|
||||||
</select>
|
</select>
|
||||||
<select class="default-input" name="group" onchange="document.forms['filter'].submit()">
|
<select class="default-input" name="group" onchange="document.forms['filter'].submit()">
|
||||||
<option value="---">-- {%trans "Group" %}--</option>
|
<option value="---">-- {%trans "Group" %}--</option>
|
||||||
{% for group in groups %}
|
{% for group in groups %}
|
||||||
<option value="{{ group }}" {% if group in request.GET.group %}selected{% endif %}>
|
<option value="{{ group }}" {% if group in sortfilter.group %}selected{% endif %}>
|
||||||
{{ group }}</option>
|
{{ group }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
<select class="default-input" name="type" onchange="document.forms['filter'].submit()">
|
<select class="default-input" name="type" onchange="document.forms['filter'].submit()">
|
||||||
<option value="---">-- {%trans "Type" %}--</option>
|
<option value="---">-- {%trans "Type" %}--</option>
|
||||||
<option value="delegate" {% if 'delegate' in request.GET.type %}selected{% endif %}>{%trans "Delegate" %}</option>
|
<option value="delegate" {% if 'delegate' in sortfilter.type %}selected{% endif %}>{%trans "Delegate" %}</option>
|
||||||
<option value="observer" {% if 'observer' in request.GET.type %}selected{% endif %}>{%trans "Observer" %}</option>
|
<option value="observer" {% if 'observer' in sortfilter.type %}selected{% endif %}>{%trans "Observer" %}</option>
|
||||||
<option value="staff" {% if 'staff' in request.GET.type %}selected{% endif %}>{%trans "Staff" %}</option>
|
<option value="staff" {% if 'staff' in sortfilter.type %}selected{% endif %}>{%trans "Staff" %}</option>
|
||||||
<option value="guest" {% if 'guest' in request.GET.type %}selected{% endif %}>{%trans "Guest" %}</option>
|
<option value="guest" {% if 'guest' in sortfilter.type %}selected{% endif %}>{%trans "Guest" %}</option>
|
||||||
</select>
|
</select>
|
||||||
<select class="default-input" name="committee" onchange="document.forms['filter'].submit()">
|
<select class="default-input" name="committee" onchange="document.forms['filter'].submit()">
|
||||||
<option value="---">-- {%trans "Committee" %}--</option>
|
<option value="---">-- {%trans "Committee" %}--</option>
|
||||||
{% for committee in committees %}
|
{% for committee in committees %}
|
||||||
<option value="{{ committee }}" {% if committee in request.GET.committee %}selected{% endif %}>
|
<option value="{{ committee }}" {% if committee in sortfilter.committee %}selected{% endif %}>
|
||||||
{{ committee }}</option>
|
{{ committee }}</option>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</select>
|
</select>
|
||||||
@ -38,15 +39,15 @@
|
|||||||
{{ users|length }} {% trans "Participant" %}
|
{{ users|length }} {% trans "Participant" %}
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th><a href="?sort=first_name{% if 'first_name' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "First Name" %}</a></th>
|
<th><a href="?sort=first_name&reverse={% if 'first_name' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{%trans "First Name" %}</a></th>
|
||||||
<th><a href="?sort=last_name{% if 'last_name' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Last Name" %}</a></th>
|
<th><a href="?sort=last_name&reverse={% if 'last_name' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{%trans "Last Name" %}</a></th>
|
||||||
<th><a href="?sort=group{% if 'group' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Group" %}</a></th>
|
<th><a href="?sort=group&reverse={% if 'group' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{%trans "Group" %}</a></th>
|
||||||
<th><a href="?sort=type{% if 'type' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Type" %}</a></th>
|
<th><a href="?sort=type&reverse={% if 'type' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{%trans "Type" %}</a></th>
|
||||||
<th><a href="?sort=committee{% if 'committee' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Committee" %}</a></th>
|
<th><a href="?sort=committee&reverse={% if 'committee' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{%trans "Committee" %}</a></th>
|
||||||
{% if perms.participant.can_manage_participant %}
|
{% if perms.participant.can_manage_participant %}
|
||||||
<th><a href="?sort=username{% if 'username' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Username" %}</a></th>
|
<th><a href="?sort=username&reverse={% if 'username' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{%trans "Username" %}</a></th>
|
||||||
<th><a href="?sort=email{% if 'email' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Email" %}</a></th>
|
<th><a href="?sort=email&reverse={% if 'email' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{%trans "Email" %}</a></th>
|
||||||
<th><a href="?sort=last_login{% if 'last_login' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Last Login" %}</a></th>
|
<th><a href="?sort=last_login&reverse={% if 'last_login' in sortfilter.sort and 'reverse' not in sortfilter %}1{% else %}---{%endif%}">{%trans "Last Login" %}</a></th>
|
||||||
<th>{%trans "Actions" %}</th>
|
<th>{%trans "Actions" %}</th>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
|
@ -11,6 +11,9 @@
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import csv
|
import csv
|
||||||
|
from urllib import urlencode
|
||||||
|
from urlparse import parse_qs
|
||||||
|
|
||||||
from django.http import HttpResponse
|
from django.http import HttpResponse
|
||||||
from django.shortcuts import redirect
|
from django.shortcuts import redirect
|
||||||
from django.template import RequestContext
|
from django.template import RequestContext
|
||||||
@ -33,24 +36,41 @@ from django.db.models import Avg, Max, Min, Count
|
|||||||
@permission_required('participant.can_see_participant')
|
@permission_required('participant.can_see_participant')
|
||||||
@template('participant/overview.html')
|
@template('participant/overview.html')
|
||||||
def get_overview(request):
|
def get_overview(request):
|
||||||
query = User.objects
|
def decodedict(dict):
|
||||||
if 'gender' in request.GET and '---' not in request.GET['gender']:
|
newdict = {}
|
||||||
query = query.filter(profile__gender__iexact=request.GET['gender'])
|
for key in dict:
|
||||||
if 'group' in request.GET and '---' not in request.GET['group']:
|
newdict[key] = [dict[key][0].encode('utf-8')]
|
||||||
query = query.filter(profile__group__iexact=request.GET['group'])
|
return newdict
|
||||||
if 'type' in request.GET and '---' not in request.GET['type']:
|
|
||||||
query = query.filter(profile__type__iexact=request.GET['type'])
|
|
||||||
if 'committee' in request.GET and '---' not in request.GET['committee']:
|
|
||||||
query = query.filter(profile__committee__iexact=request.GET['committee'])
|
|
||||||
try:
|
try:
|
||||||
sort = request.GET['sort']
|
sortfilter = parse_qs(request.COOKIES['participant_sortfilter'])
|
||||||
if sort in ['first_name', 'last_name','username','last_login','email']:
|
|
||||||
query = query.order_by(sort)
|
|
||||||
elif sort in ['group', 'type', 'committee']:
|
|
||||||
query = query.order_by('profile__%s' % sort)
|
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
sortfilter = {}
|
||||||
if 'reverse' in request.GET:
|
|
||||||
|
for value in [u'gender', u'group', u'type', u'committee', u'sort', u'reverse']:
|
||||||
|
if value in request.REQUEST:
|
||||||
|
if request.REQUEST[value] == '---':
|
||||||
|
try:
|
||||||
|
del sortfilter[value]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
sortfilter[value] = [request.REQUEST[value]]
|
||||||
|
|
||||||
|
query = User.objects
|
||||||
|
if 'gender' in sortfilter:
|
||||||
|
query = query.filter(profile__gender__iexact=sortfilter['gender'][0])
|
||||||
|
if 'group' in sortfilter:
|
||||||
|
query = query.filter(profile__group__iexact=sortfilter['group'][0])
|
||||||
|
if 'type' in sortfilter:
|
||||||
|
query = query.filter(profile__type__iexact=sortfilter['type'][0])
|
||||||
|
if 'committee' in sortfilter:
|
||||||
|
query = query.filter(profile__committee__iexact=sortfilter['committee'][0])
|
||||||
|
if 'sort' in sortfilter:
|
||||||
|
if sortfilter['sort'][0] in ['first_name', 'last_name','username','last_login','email']:
|
||||||
|
query = query.order_by(sortfilter['sort'][0])
|
||||||
|
elif sortfilter['sort'][0] in ['group', 'type', 'committee']:
|
||||||
|
query = query.order_by('profile__%s' % sortfilter['sort'][0])
|
||||||
|
if 'reverse' in sortfilter:
|
||||||
query = query.reverse()
|
query = query.reverse()
|
||||||
|
|
||||||
userlist = query.all()
|
userlist = query.all()
|
||||||
@ -67,6 +87,8 @@ def get_overview(request):
|
|||||||
'users': users,
|
'users': users,
|
||||||
'groups': groups,
|
'groups': groups,
|
||||||
'committees': committees,
|
'committees': committees,
|
||||||
|
'cookie': ['participant_sortfilter', urlencode(decodedict(sortfilter), doseq=True)],
|
||||||
|
'sortfilter': sortfilter,
|
||||||
}
|
}
|
||||||
|
|
||||||
@permission_required('participant.can_manage_participant')
|
@permission_required('participant.can_manage_participant')
|
||||||
|
@ -20,8 +20,8 @@ class PollForm(ModelForm):
|
|||||||
error_css_class = 'error'
|
error_css_class = 'error'
|
||||||
required_css_class = 'required'
|
required_css_class = 'required'
|
||||||
|
|
||||||
votescast = IntegerField(required=False,widget=TextInput(attrs={'class':'small-input'}),label=_("Votes cast"))
|
votescast = IntegerField(required=False, min_value=-2, widget=TextInput(attrs={'class':'small-input'}),label=_("Votes cast"))
|
||||||
invalid = IntegerField(required=False, min_value=0, widget=TextInput(attrs={'class': 'small-input'}), label=_("Invalid"))
|
invalid = IntegerField(required=False, min_value=-2, widget=TextInput(attrs={'class': 'small-input'}), label=_("Invalid"))
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Poll
|
model = Poll
|
||||||
@ -42,6 +42,6 @@ class OptionResultForm(Form):
|
|||||||
error_css_class = 'error'
|
error_css_class = 'error'
|
||||||
required_css_class = 'required'
|
required_css_class = 'required'
|
||||||
|
|
||||||
yes = IntegerField(min_value=-1, widget=TextInput(attrs={'class': 'small-input'}), label=_("Yes"))
|
yes = IntegerField(min_value=-2, widget=TextInput(attrs={'class': 'small-input'}), label=_("Yes"))
|
||||||
no = IntegerField(min_value=-1, required=False, widget=TextInput(attrs={'class': 'small-input'}), label=_("No"))
|
no = IntegerField(min_value=-2, required=False, widget=TextInput(attrs={'class': 'small-input'}), label=_("No"))
|
||||||
undesided = IntegerField(min_value=-1, required=False, widget=TextInput(attrs={'class': 'small-input'}), label=_("Abstention"))
|
undesided = IntegerField(min_value=-2, required=False, widget=TextInput(attrs={'class': 'small-input'}), label=_("Abstention"))
|
||||||
|
@ -40,6 +40,22 @@ class Poll(models.Model):
|
|||||||
optionc.save()
|
optionc.save()
|
||||||
return optionc
|
return optionc
|
||||||
|
|
||||||
|
@property
|
||||||
|
def votescastf(self):
|
||||||
|
if self.votescast == -2:
|
||||||
|
return _('undocumented')
|
||||||
|
elif self.votescast:
|
||||||
|
return self.votescast
|
||||||
|
return '0'
|
||||||
|
|
||||||
|
@property
|
||||||
|
def votesinvalidf(self):
|
||||||
|
if self.votesinvalid == -2:
|
||||||
|
return _('undocumented')
|
||||||
|
elif self.votesinvalid:
|
||||||
|
return self.votesinvalid
|
||||||
|
return '0'
|
||||||
|
|
||||||
def has_vote(self):
|
def has_vote(self):
|
||||||
for option in self.options:
|
for option in self.options:
|
||||||
if option.voteyes or option.voteno or option.voteundesided:
|
if option.voteyes or option.voteno or option.voteundesided:
|
||||||
@ -71,7 +87,7 @@ class Poll(models.Model):
|
|||||||
if self.assignment:
|
if self.assignment:
|
||||||
return Poll.objects.filter(assignment=self.assignment).count()
|
return Poll.objects.filter(assignment=self.assignment).count()
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def ballot(self):
|
def ballot(self):
|
||||||
if self.application:
|
if self.application:
|
||||||
@ -125,6 +141,8 @@ class Option(models.Model):
|
|||||||
def yes(self):
|
def yes(self):
|
||||||
if self.voteyes == -1:
|
if self.voteyes == -1:
|
||||||
return _('majority')
|
return _('majority')
|
||||||
|
if self.voteyes == -2:
|
||||||
|
return _('undocumented')
|
||||||
if self.voteyes:
|
if self.voteyes:
|
||||||
return self.voteyes
|
return self.voteyes
|
||||||
return '0'
|
return '0'
|
||||||
@ -133,6 +151,8 @@ class Option(models.Model):
|
|||||||
def no(self):
|
def no(self):
|
||||||
if self.voteno == -1:
|
if self.voteno == -1:
|
||||||
return _('majority')
|
return _('majority')
|
||||||
|
if self.voteno == -2:
|
||||||
|
return _('undocumented')
|
||||||
if self.voteno:
|
if self.voteno:
|
||||||
return self.voteno
|
return self.voteno
|
||||||
return '0'
|
return '0'
|
||||||
@ -141,6 +161,8 @@ class Option(models.Model):
|
|||||||
def undesided(self):
|
def undesided(self):
|
||||||
if self.voteundesided == -1:
|
if self.voteundesided == -1:
|
||||||
return _('majority')
|
return _('majority')
|
||||||
|
if self.voteundesided == -2:
|
||||||
|
return _('undocumented')
|
||||||
if self.voteundesided:
|
if self.voteundesided:
|
||||||
return self.voteundesided
|
return self.voteundesided
|
||||||
return '0'
|
return '0'
|
||||||
@ -156,10 +178,6 @@ class Option(models.Model):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
if self.text != "" and self.text is not None:
|
if self.value:
|
||||||
return self.text
|
return unicode(self.value)
|
||||||
if self.user is not None:
|
|
||||||
return unicode(self.user)
|
|
||||||
if self.application is not None:
|
|
||||||
return unicode(self.application)
|
|
||||||
return _("No options")
|
return _("No options")
|
||||||
|
@ -36,7 +36,7 @@ from openslides.agenda.models import Item
|
|||||||
from openslides.agenda.api import children_list
|
from openslides.agenda.api import children_list
|
||||||
from openslides.application.models import Application
|
from openslides.application.models import Application
|
||||||
from openslides.assignment.models import Assignment
|
from openslides.assignment.models import Assignment
|
||||||
from openslides.poll.models import Poll
|
from openslides.poll.models import Poll, Option
|
||||||
from openslides.participant.models import Profile
|
from openslides.participant.models import Profile
|
||||||
from openslides.system.api import config_get
|
from openslides.system.api import config_get
|
||||||
from openslides.settings import SITE_ROOT
|
from openslides.settings import SITE_ROOT
|
||||||
@ -104,14 +104,14 @@ stylesheet.add(ParagraphStyle(name = 'Heading4',
|
|||||||
stylesheet.add(ParagraphStyle(name = 'Item',
|
stylesheet.add(ParagraphStyle(name = 'Item',
|
||||||
parent = stylesheet['Normal'],
|
parent = stylesheet['Normal'],
|
||||||
fontSize = 14,
|
fontSize = 14,
|
||||||
leading = 12,
|
leading = 14,
|
||||||
leftIndent = 0,
|
leftIndent = 0,
|
||||||
spaceAfter = 15)
|
spaceAfter = 15)
|
||||||
)
|
)
|
||||||
stylesheet.add(ParagraphStyle(name = 'Subitem',
|
stylesheet.add(ParagraphStyle(name = 'Subitem',
|
||||||
parent = stylesheet['Normal'],
|
parent = stylesheet['Normal'],
|
||||||
fontSize = 10,
|
fontSize = 10,
|
||||||
leading = 4,
|
leading = 10,
|
||||||
leftIndent = 20,
|
leftIndent = 20,
|
||||||
spaceAfter = 15)
|
spaceAfter = 15)
|
||||||
)
|
)
|
||||||
@ -237,8 +237,11 @@ def print_agenda(request):
|
|||||||
# print all items"
|
# print all items"
|
||||||
if item.parents:
|
if item.parents:
|
||||||
space = ""
|
space = ""
|
||||||
|
counter = 0
|
||||||
for p in item.parents:
|
for p in item.parents:
|
||||||
space += " "
|
if counter != 0:
|
||||||
|
space += " "
|
||||||
|
counter += 1
|
||||||
story.append(Paragraph(space+item.title, stylesheet['Subitem']))
|
story.append(Paragraph(space+item.title, stylesheet['Subitem']))
|
||||||
else:
|
else:
|
||||||
story.append(Paragraph(item.title, stylesheet['Item']))
|
story.append(Paragraph(item.title, stylesheet['Item']))
|
||||||
@ -488,6 +491,25 @@ def print_application_poll(request, poll_id=None):
|
|||||||
doc.build(story)
|
doc.build(story)
|
||||||
return response
|
return response
|
||||||
|
|
||||||
|
def get_assignment_votes(assignment):
|
||||||
|
votes = []
|
||||||
|
for candidate in assignment.candidates:
|
||||||
|
tmplist = [[candidate, assignment.is_elected(candidate)], []]
|
||||||
|
for poll in assignment.poll_set.all():
|
||||||
|
if poll.published:
|
||||||
|
if candidate in poll.options_values:
|
||||||
|
option = Option.objects.filter(poll=poll).filter(user=candidate)[0]
|
||||||
|
if poll.optiondecision:
|
||||||
|
tmplist[1].append([option.yes, option.no, option.undesided])
|
||||||
|
else:
|
||||||
|
tmplist[1].append(option.yes)
|
||||||
|
else:
|
||||||
|
tmplist[1].append("-")
|
||||||
|
elif len(tmplist[1]) == 0:
|
||||||
|
return votes
|
||||||
|
votes.append(tmplist)
|
||||||
|
return votes
|
||||||
|
|
||||||
def get_assignment(assignment, story):
|
def get_assignment(assignment, story):
|
||||||
# title
|
# title
|
||||||
story.append(Paragraph(_("Election")+": %s" % assignment.name, stylesheet['Heading1']))
|
story.append(Paragraph(_("Election")+": %s" % assignment.name, stylesheet['Heading1']))
|
||||||
@ -507,10 +529,74 @@ def get_assignment(assignment, story):
|
|||||||
for x in range(0,2*assignment.posts):
|
for x in range(0,2*assignment.posts):
|
||||||
cell2b.append(Paragraph("<seq id='counter'/>. __________________________________________",stylesheet['Signaturefield']))
|
cell2b.append(Paragraph("<seq id='counter'/>. __________________________________________",stylesheet['Signaturefield']))
|
||||||
cell2b.append(Spacer(0,0.2*cm))
|
cell2b.append(Spacer(0,0.2*cm))
|
||||||
|
# vote results
|
||||||
|
table_votes = []
|
||||||
|
results = get_assignment_votes(assignment)
|
||||||
|
cell3a = []
|
||||||
|
cell3a.append(Paragraph("%s:" % (_("Vote results")), stylesheet['Heading4']))
|
||||||
|
if len(results) > 0:
|
||||||
|
if len(results[0]) >= 1:
|
||||||
|
cell3a.append(Paragraph("%s %s" % (len(results[0][1]), _("ballots")), stylesheet['Normal']))
|
||||||
|
if len(results[0][1]) > 0:
|
||||||
|
data_votes = []
|
||||||
|
# add table head row
|
||||||
|
headrow = []
|
||||||
|
headrow.append(_("Candidates"))
|
||||||
|
for i in range (0,len(results[0][1])):
|
||||||
|
headrow.append("%s." %(str(i+1)))
|
||||||
|
data_votes.append(headrow)
|
||||||
|
# add result rows
|
||||||
|
for candidate in results:
|
||||||
|
row = []
|
||||||
|
row.append(str(candidate[0][0]))
|
||||||
|
for votes in candidate[1]:
|
||||||
|
if type(votes) == type(list()):
|
||||||
|
tmp = "list"
|
||||||
|
tmp = _("Yes")+": "+str(votes[0])+"\n"
|
||||||
|
tmp += _("No")+": "+str(votes[1])+"\n"
|
||||||
|
tmp += _("Abstention")+": "+str(votes[2])
|
||||||
|
row.append(tmp)
|
||||||
|
else:
|
||||||
|
row.append(str(votes))
|
||||||
|
|
||||||
|
data_votes.append(row)
|
||||||
|
polls = []
|
||||||
|
for poll in assignment.poll_set.filter(assignment=assignment):
|
||||||
|
polls.append(poll)
|
||||||
|
# votes invalid
|
||||||
|
row = []
|
||||||
|
row.append(_("Invalid votes"))
|
||||||
|
for p in polls:
|
||||||
|
if p.published:
|
||||||
|
row.append(p.votesinvalid)
|
||||||
|
data_votes.append(row)
|
||||||
|
|
||||||
|
# votes cast
|
||||||
|
row = []
|
||||||
|
row.append(_("Votes cast"))
|
||||||
|
for p in polls:
|
||||||
|
if p.published:
|
||||||
|
row.append(p.votescast)
|
||||||
|
data_votes.append(row)
|
||||||
|
|
||||||
|
table_votes=Table(data_votes)
|
||||||
|
table_votes.setStyle( TableStyle([
|
||||||
|
('GRID', (0,0), (-1,-1), 0.5, colors.grey),
|
||||||
|
('VALIGN',(0,0),(-1,-1), 'TOP'),
|
||||||
|
('LINEABOVE',(0,0),(-1,0),2,colors.black),
|
||||||
|
('LINEABOVE',(0,1),(-1,1),1,colors.black),
|
||||||
|
('LINEBELOW',(0,-1),(-1,-1),2,colors.black),
|
||||||
|
('ROWBACKGROUNDS', (0, 1), (-1, -1), (colors.white, (.9, .9, .9))),
|
||||||
|
]))
|
||||||
|
|
||||||
# table
|
# table
|
||||||
data = []
|
data = []
|
||||||
data.append([cell1a,cell1b])
|
data.append([cell1a,cell1b])
|
||||||
data.append([cell2a,cell2b])
|
if table_votes:
|
||||||
|
data.append([cell3a,table_votes])
|
||||||
|
else:
|
||||||
|
data.append([cell2a,cell2b])
|
||||||
|
data.append([Spacer(0,0.2*cm),''])
|
||||||
t=Table(data)
|
t=Table(data)
|
||||||
t._argW[0]=4.5*cm
|
t._argW[0]=4.5*cm
|
||||||
t._argW[1]=11*cm
|
t._argW[1]=11*cm
|
||||||
|
@ -49,7 +49,10 @@ def template(template_name):
|
|||||||
output = func(request, *args, **kw)
|
output = func(request, *args, **kw)
|
||||||
if not isinstance(output, dict):
|
if not isinstance(output, dict):
|
||||||
return output
|
return output
|
||||||
return render_to_response(template_name, output, context_instance=RequestContext(request))
|
response = render_to_response(template_name, output, context_instance=RequestContext(request))
|
||||||
|
if 'cookie' in output:
|
||||||
|
response.set_cookie(output['cookie'][0], output['cookie'][1])
|
||||||
|
return response
|
||||||
return wrapper
|
return wrapper
|
||||||
return renderer
|
return renderer
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user