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 = [] actions = []
# check if user allowed to withdraw an application # check if user allowed to withdraw an application
if (self.status == "pub" if ((self.status == "pub"
and self.number \ and self.number
and user == self.submitter) \ and user == self.submitter)
or (self.status == "pub" \ or (self.status == "pub"
and self.number \ and self.number
and user.has_perm("application.can_manage_application")) \ and user.has_perm("application.can_manage_application"))
or (self.status == "per" \ or (self.status == "per"
and user == self.submitter) \ and user == self.submitter)
or (self.status == "per" \ or (self.status == "per"
and user.has_perm("application.can_manage_application")): and user.has_perm("application.can_manage_application"))):
actions.append("wit") actions.append("wit")
#Check if the user can review the application #Check if the user can review the application
if self.status == "rev" \ if (self.status == "rev"
and (self.submitter == user \ and (self.submitter == user
or user.has_perm("application.can_manage_application")): or user.has_perm("application.can_manage_application"))):
actions.append("pub") actions.append("pub")
try:
# Check if the user can support and unspoort the application # Check if the user can support and unspoort the application
if self.status == "pub" \ try:
and user != self.submitter \ if (self.status == "pub"
and user not in self.supporter.all() \ and user != self.submitter
and getattr(user, 'profile', None): and user not in self.supporter.all()
and getattr(user, 'profile', None)):
print "es ist ok"
actions.append("support") actions.append("support")
except Profile.DoesNotExist: except Profile.DoesNotExist:
pass pass

View File

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

View File

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

View File

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