some fixes

This commit is contained in:
Oskar Hahn 2012-04-15 13:10:24 +02:00
parent b620c0afb7
commit 91c9e1e9ab
4 changed files with 44 additions and 39 deletions

View File

@ -315,28 +315,30 @@ class Application(models.Model, SlideMixin):
actions = []
# check if user allowed to withdraw an application
if (self.status == "pub"
and self.number \
and user == self.submitter) \
or (self.status == "pub" \
and self.number \
and user.has_perm("application.can_manage_application")) \
or (self.status == "per" \
and user == self.submitter) \
or (self.status == "per" \
and user.has_perm("application.can_manage_application")):
if ((self.status == "pub"
and self.number
and user == self.submitter)
or (self.status == "pub"
and self.number
and user.has_perm("application.can_manage_application"))
or (self.status == "per"
and user == self.submitter)
or (self.status == "per"
and user.has_perm("application.can_manage_application"))):
actions.append("wit")
#Check if the user can review the application
if self.status == "rev" \
and (self.submitter == user \
or user.has_perm("application.can_manage_application")):
if (self.status == "rev"
and (self.submitter == user
or user.has_perm("application.can_manage_application"))):
actions.append("pub")
try:
# Check if the user can support and unspoort the application
if self.status == "pub" \
and user != self.submitter \
and user not in self.supporter.all() \
and getattr(user, 'profile', None):
try:
if (self.status == "pub"
and user != self.submitter
and user not in self.supporter.all()
and getattr(user, 'profile', None)):
print "es ist ok"
actions.append("support")
except Profile.DoesNotExist:
pass

View File

@ -30,32 +30,32 @@
{{ applications|length }} {% trans "Applications" %}
<table>
<tr>
<th><a href="?sort=number{% if 'number' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Number" %}</a></th>
<th><a href="?sort=aversion__title{% if 'aversion__title' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Application title" %}</a></th>
{% if min_supporters > 0 %}
<th><a href="?sort=supporter{% if 'supporter' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Number of supporters" %}</a></th>
{% endif %}
<th><a href="?sort=status{% if 'status' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Status" %}</a></th>
<th><a href="?sort=submitter{% if 'submitter' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Submitter" %}</a></th>
<th><a href="?sort=aversion__time{% if 'aversion__time' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Creation Time" %}<a></th>
<th><a href="?sort=number{% if 'number' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Number" %}</a></th>
<th><a href="?sort=aversion__title{% if 'aversion__title' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Application title" %}</a></th>
{% if min_supporters > 0 %}
<th><a href="?sort=supporter{% if 'supporter' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Number of supporters" %}</a></th>
{% endif %}
<th><a href="?sort=status{% if 'status' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Status" %}</a></th>
<th><a href="?sort=submitter{% if 'submitter' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Submitter" %}</a></th>
<th><a href="?sort=aversion__time{% if 'aversion__time' in request.GET.sort and 'reverse' not in request.GET %}&reverse{%endif%}">{%trans "Creation Time" %}<a></th>
</tr>
{% for application in applications %}
<tr class="{% cycle '' 'odd' %}">
<td>{% if application.number %}{{ application.number }}{% else %}-{% endif %}</td>
<td><a href="{% url application_view application.id %}">{{ application }}</a></td>
<td>{% if application.number %}{{ application.number }}{% else %}-{% endif %}</td>
<td><a href="{% url application_view application.id %}">{{ application }}</a></td>
{% if min_supporters > 0 %}
<td>{{ application.supporter.count }}</td>
<td>{{ application.supporter.count }}</td>
{% endif %}
<td>{% if application.status != "pub" %}
{{ application.get_status_display }}<br>
{% endif %}
{% for note in application.notes %}
{{ note }}
{% if not forloop.last %}<br>{%endif%}
{% endfor %}
</td>
<td>{{ application.submitter.profile }}</td>
<td>{{ application.creation_time }}</td>
<td>{% if application.status != "pub" %}
{{ application.get_status_display }}<br>
{% endif %}
{% for note in application.notes %}
{{ note }}
{% if not forloop.last %}<br>{%endif%}
{% endfor %}
</td>
<td>{{ application.submitter.profile }}</td>
<td>{{ application.creation_time }}</td>
</tr>
{% empty %}
<tr>

View File

@ -64,6 +64,7 @@
{% endif %}
<ul class="results">
{% for poll in polls %}
{% if perms.application.can_manage_application or poll.has_votes %}
<li>
{% if perms.application.can_manage_application %}
<a href="{% url application_poll_view poll.id %}">
@ -101,6 +102,7 @@
{% endif %}
{% endif %}
</li>
{% endif %}
{% endfor %}
</ul>
{% endwith %}

View File

@ -55,6 +55,7 @@ from utils.template import Tab
from participant.api import gen_username, gen_password
@permission_required('application.can_see_application')
@template('application/overview.html')
def overview(request):