Added new button in assignment view template to show agenda item of selected assignment (for manager only).

This commit is contained in:
Emanuel Schuetze 2011-11-01 14:45:24 +01:00
parent 6d7736d10d
commit f26a19036b
4 changed files with 18 additions and 5 deletions

View File

@ -320,16 +320,12 @@ def unsupport(request, application_id):
@permission_required('application.can_manage_application') @permission_required('application.can_manage_application')
@template('application/view.html')
def set_active(request, application_id): def set_active(request, application_id):
print application_id
item = Item.objects.get(itemapplication__application__id=application_id) item = Item.objects.get(itemapplication__application__id=application_id)
print item.id
item.set_active(False) item.set_active(False)
# if request.is_ajax():
# return ajax_request({'active': item.id})
return redirect(reverse('application_view', args=[application_id])) return redirect(reverse('application_view', args=[application_id]))
@permission_required('application.can_manage_application') @permission_required('application.can_manage_application')
@template('application/view.html') @template('application/view.html')
def gen_poll(request, application_id): def gen_poll(request, application_id):

View File

@ -41,6 +41,13 @@
<span class="icon item">{%trans 'New agenda item' %}</span> <span class="icon item">{%trans 'New agenda item' %}</span>
</button> </button>
</a> </a>
{% else %}
<h4></h4>
<a href='{% url assignment_activate_item assignment.id %}'>
<button>
<span class="icon projector">{%trans 'Show agenda item' %}</span>
</button>
</a>
{% endif %} {% endif %}
</div> </div>
{% endif %} {% endif %}

View File

@ -40,6 +40,9 @@ urlpatterns = patterns('assignment.views',
url(r'^assignment/(?P<assignment_id>\d+)/delother/(?P<profile_id>\d+)$', 'delother', \ url(r'^assignment/(?P<assignment_id>\d+)/delother/(?P<profile_id>\d+)$', 'delother', \
name='assignment_delother'), name='assignment_delother'),
url(r'^assignment/(?P<assignment_id>\d+)/set_active/$', 'set_active',
name='assignment_activate_item'),
url(r'^assignment/poll/(?P<poll_id>\d+)/print$', 'print_assignment_poll', \ url(r'^assignment/poll/(?P<poll_id>\d+)/print$', 'print_assignment_poll', \
name='print_assignment_poll'), name='print_assignment_poll'),

View File

@ -16,6 +16,7 @@ from django.contrib import messages
from django.contrib.auth.decorators import login_required from django.contrib.auth.decorators import login_required
from django.utils.translation import ugettext as _ from django.utils.translation import ugettext as _
from openslides.agenda.models import Item
from poll.models import Poll, Option from poll.models import Poll, Option
from poll.forms import OptionResultForm, PollForm from poll.forms import OptionResultForm, PollForm
from assignment.models import Assignment from assignment.models import Assignment
@ -182,6 +183,12 @@ def delother(request, assignment_id, profile_id):
return redirect(reverse('assignment_view', args=assignment_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') @permission_required('assignment.can_manage_assignment')
def gen_poll(request, assignment_id): def gen_poll(request, assignment_id):
try: try: