From f26a19036b77adeb9742c39006d493adf0eb2a83 Mon Sep 17 00:00:00 2001 From: Emanuel Schuetze Date: Tue, 1 Nov 2011 14:45:24 +0100 Subject: [PATCH] Added new button in assignment view template to show agenda item of selected assignment (for manager only). --- openslides/application/views.py | 6 +----- openslides/assignment/templates/assignment/view.html | 7 +++++++ openslides/assignment/urls.py | 3 +++ openslides/assignment/views.py | 7 +++++++ 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/openslides/application/views.py b/openslides/application/views.py index 3b28738c8..32499c316 100644 --- a/openslides/application/views.py +++ b/openslides/application/views.py @@ -320,16 +320,12 @@ def unsupport(request, application_id): @permission_required('application.can_manage_application') -@template('application/view.html') def set_active(request, application_id): - print application_id item = Item.objects.get(itemapplication__application__id=application_id) - print item.id item.set_active(False) -# if request.is_ajax(): -# return ajax_request({'active': item.id}) return redirect(reverse('application_view', args=[application_id])) + @permission_required('application.can_manage_application') @template('application/view.html') def gen_poll(request, application_id): diff --git a/openslides/assignment/templates/assignment/view.html b/openslides/assignment/templates/assignment/view.html index 63d023cd7..4d31dd032 100644 --- a/openslides/assignment/templates/assignment/view.html +++ b/openslides/assignment/templates/assignment/view.html @@ -41,6 +41,13 @@ {%trans 'New agenda item' %} + {% else %} +

+ + + {% endif %} {% endif %} diff --git a/openslides/assignment/urls.py b/openslides/assignment/urls.py index 8cef45fb6..72f6ea12c 100644 --- a/openslides/assignment/urls.py +++ b/openslides/assignment/urls.py @@ -40,6 +40,9 @@ urlpatterns = patterns('assignment.views', url(r'^assignment/(?P\d+)/delother/(?P\d+)$', 'delother', \ name='assignment_delother'), + url(r'^assignment/(?P\d+)/set_active/$', 'set_active', + name='assignment_activate_item'), + url(r'^assignment/poll/(?P\d+)/print$', 'print_assignment_poll', \ name='print_assignment_poll'), diff --git a/openslides/assignment/views.py b/openslides/assignment/views.py index 88fccb733..f8d6047e5 100644 --- a/openslides/assignment/views.py +++ b/openslides/assignment/views.py @@ -16,6 +16,7 @@ from django.contrib import messages from django.contrib.auth.decorators import login_required from django.utils.translation import ugettext as _ +from openslides.agenda.models import Item from poll.models import Poll, Option from poll.forms import OptionResultForm, PollForm from assignment.models import Assignment @@ -182,6 +183,12 @@ def delother(request, assignment_id, profile_id): return redirect(reverse('assignment_view', args=assignment_id)) +@permission_required('assignment.can_manage_application') +def set_active(request, assignment_id): + item = Item.objects.get(itemassignment__assignment__id=assignment_id) + item.set_active(False) + return redirect(reverse('assignment_view', args=[assignment_id])) + @permission_required('assignment.can_manage_assignment') def gen_poll(request, assignment_id): try: