Commit 356c9835 authored by Giorgos Korfiatis's avatar Giorgos Korfiatis Committed by Georgios D. Tsoukalas
Browse files

View and dismiss denied applications of an active project

parent 992af3cc
......@@ -1596,6 +1596,21 @@ class ProjectApplication(models.Model):
def has_pending_modifications(self):
return bool(self.last_pending())
def denied_modifications(self):
q = self.chained_applications()
q = q.filter(Q(state=self.DENIED))
q = q.filter(~Q(id=self.id))
return q
def last_denied(self):
try:
return self.denied_modifications().order_by('-id')[0]
except IndexError:
return None
def has_denied_modifications(self):
return bool(self.last_denied())
def is_applied(self):
try:
self.project
......
......@@ -13,6 +13,12 @@
{% if object.has_pending_modifications %} -
<a href="{% url astakos.im.views.project_app object.last_pending.pk %}">
MODIFICATION PENDING</a>
{% else %}
<!-- note that pending modifications have priority -->
{% if object.has_denied_modifications %} -
<a href="{% url astakos.im.views.project_app object.last_denied.pk %}">
MODIFICATION DENIED</a>
{% endif %}
{% endif %}
{% else %}
<!-- application view -->
......
......@@ -1530,7 +1530,15 @@ def project_app_dismiss(request, application_id, ctx=None):
# XXX: dismiss application also does authorization
dismiss_application(application_id, request_user=request.user)
return redirect(reverse('project_list'))
chain_id = None
chain_id = get_related_project_id(application_id)
if chain_id:
next = reverse('project_detail', args=(chain_id,))
else:
next = reverse('project_list')
return redirect(next)
def landing(request):
return render_response(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment