#191 Create assignment-agenda Items
This commit is contained in:
parent
f13ee5f409
commit
b12ae6b0a0
@ -110,6 +110,7 @@ class Item(MPTTModel, SlideMixin):
|
|||||||
|
|
||||||
link can be:
|
link can be:
|
||||||
* view
|
* view
|
||||||
|
* edit
|
||||||
* delete
|
* delete
|
||||||
"""
|
"""
|
||||||
if link == 'view':
|
if link == 'view':
|
||||||
|
@ -39,7 +39,7 @@
|
|||||||
|
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<form action="/agenda/" method="post">{% csrf_token %}
|
<form action="" method="post">{% csrf_token %}
|
||||||
{% if perms.agenda.can_manage_agenda %}
|
{% if perms.agenda.can_manage_agenda %}
|
||||||
<div id="changed-order-message" style="display:none" class="notification warning">
|
<div id="changed-order-message" style="display:none" class="notification warning">
|
||||||
<em>{% trans "Do you want to save the changed order of agenda items?" %}<br>
|
<em>{% trans "Do you want to save the changed order of agenda items?" %}<br>
|
||||||
|
@ -129,6 +129,8 @@ class Assignment(models.Model, SlideMixin):
|
|||||||
votes.append(tmplist)
|
votes.append(tmplist)
|
||||||
return votes
|
return votes
|
||||||
|
|
||||||
|
def get_agenda_title(self):
|
||||||
|
return self.name
|
||||||
|
|
||||||
def slide(self):
|
def slide(self):
|
||||||
"""
|
"""
|
||||||
@ -144,11 +146,11 @@ class Assignment(models.Model, SlideMixin):
|
|||||||
|
|
||||||
def get_absolute_url(self, link='view'):
|
def get_absolute_url(self, link='view'):
|
||||||
if link == 'view':
|
if link == 'view':
|
||||||
return reverse('assignment_view', [str(self.id)])
|
return reverse('assignment_view', args=(str(self.id)))
|
||||||
if link == 'edit':
|
if link == 'edit':
|
||||||
return reverse('assignment_edit', args=[str(self.id)])
|
return reverse('assignment_edit', args=(str(self.id)))
|
||||||
if link == 'delete':
|
if link == 'delete':
|
||||||
return reverse('assignment_delete', [str(self.id)])
|
return reverse('assignment_delete', args=(str(self.id)))
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
@ -45,6 +45,13 @@
|
|||||||
<li><a href="{% url projector_activate_slide assignment.sid %}"><img src="{% static 'images/icons/projector.png' %}"> {%trans 'Show election' %}</a></li>
|
<li><a href="{% url projector_activate_slide assignment.sid %}"><img src="{% static 'images/icons/projector.png' %}"> {%trans 'Show election' %}</a></li>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
|
{# agenda #}
|
||||||
|
{% if perms.agenda.can_manage_agenda %}
|
||||||
|
<li>
|
||||||
|
<a href="{% url assignment_create_agenda assignment.id %}">{%trans 'New agenda item' %}</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
{# polls #}
|
{# polls #}
|
||||||
{% if perms.assignment.can_manage_assignment %}
|
{% if perms.assignment.can_manage_assignment %}
|
||||||
{% for poll in polls %}
|
{% for poll in polls %}
|
||||||
|
@ -12,7 +12,8 @@
|
|||||||
|
|
||||||
from django.conf.urls.defaults import *
|
from django.conf.urls.defaults import *
|
||||||
|
|
||||||
from assignment.views import ViewPoll, AssignmentPDF, AssignmentPollPDF, AssignmentPollDelete
|
from assignment.views import (ViewPoll, AssignmentPDF, AssignmentPollPDF,
|
||||||
|
AssignmentPollDelete, CreateAgendaItem)
|
||||||
|
|
||||||
urlpatterns = patterns('assignment.views',
|
urlpatterns = patterns('assignment.views',
|
||||||
url(r'^$',
|
url(r'^$',
|
||||||
@ -64,12 +65,17 @@ urlpatterns = patterns('assignment.views',
|
|||||||
name='assignment_activate_item',
|
name='assignment_activate_item',
|
||||||
),
|
),
|
||||||
|
|
||||||
url(r'^poll/(?P<poll_id>\d+)/print$',
|
url(r'^poll/(?P<poll_id>\d+)/print/$',
|
||||||
AssignmentPollPDF.as_view(),
|
AssignmentPollPDF.as_view(),
|
||||||
name='print_assignment_poll',
|
name='print_assignment_poll',
|
||||||
),
|
),
|
||||||
|
|
||||||
url(r'^print$',
|
url(r'^(?P<assignment_id>\d+)/agenda/$',
|
||||||
|
CreateAgendaItem.as_view(),
|
||||||
|
name='assignment_create_agenda',
|
||||||
|
),
|
||||||
|
|
||||||
|
url(r'^print/$',
|
||||||
AssignmentPDF.as_view(),
|
AssignmentPDF.as_view(),
|
||||||
name='print_assignment',
|
name='print_assignment',
|
||||||
),
|
),
|
||||||
|
@ -28,13 +28,15 @@ from settings import SITE_ROOT
|
|||||||
|
|
||||||
from utils.utils import template, permission_required, gen_confirm_form, del_confirm_form, ajax_request
|
from utils.utils import template, permission_required, gen_confirm_form, del_confirm_form, ajax_request
|
||||||
from utils.pdf import stylesheet
|
from utils.pdf import stylesheet
|
||||||
from utils.views import FormView, DeleteView, PDFView
|
from utils.views import FormView, DeleteView, PDFView, RedirectView
|
||||||
from utils.template import Tab
|
from utils.template import Tab
|
||||||
|
|
||||||
from projector.api import get_model_widget
|
from projector.api import get_model_widget
|
||||||
|
|
||||||
from poll.views import PollFormView
|
from poll.views import PollFormView
|
||||||
|
|
||||||
|
from agenda.models import Item
|
||||||
|
|
||||||
from assignment.models import Assignment, AssignmentPoll, AssignmentOption
|
from assignment.models import Assignment, AssignmentPoll, AssignmentOption
|
||||||
from assignment.forms import AssignmentForm, AssignmentRunForm, ConfigForm
|
from assignment.forms import AssignmentForm, AssignmentRunForm, ConfigForm
|
||||||
|
|
||||||
@ -463,6 +465,18 @@ class AssignmentPDF(PDFView):
|
|||||||
return votes
|
return votes
|
||||||
|
|
||||||
|
|
||||||
|
class CreateAgendaItem(RedirectView):
|
||||||
|
permission_required = 'agenda.can_manage_agenda'
|
||||||
|
|
||||||
|
def pre_redirect(self, request, *args, **kwargs):
|
||||||
|
self.assignment = Assignment.objects.get(pk=kwargs['assignment_id'])
|
||||||
|
self.item = Item(releated_sid=self.assignment.sid)
|
||||||
|
self.item.save()
|
||||||
|
|
||||||
|
def get_redirect_url(self, **kwargs):
|
||||||
|
return reverse('item_overview')
|
||||||
|
|
||||||
|
|
||||||
class AssignmentPollPDF(PDFView):
|
class AssignmentPollPDF(PDFView):
|
||||||
permission_required = 'assignment.can_manage_assignment'
|
permission_required = 'assignment.can_manage_assignment'
|
||||||
top_space = 0
|
top_space = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user