diff --git a/openslides/agenda/forms.py b/openslides/agenda/forms.py index 423bbbfb0..098e949de 100644 --- a/openslides/agenda/forms.py +++ b/openslides/agenda/forms.py @@ -17,7 +17,7 @@ from django.utils.translation import ugettext_lazy as _ from mptt.forms import TreeNodeChoiceField from openslides.utils.forms import CssClassMixin -from openslides.agenda.models import Item +from .models import Item class ItemForm(forms.ModelForm, CssClassMixin): @@ -32,8 +32,7 @@ class ItemForm(forms.ModelForm, CssClassMixin): error_message=_("Invalid format. Hours from 0 to 99 and minutes from 00 to 59"), max_length=5, required=False, - label=_("Duration (hh:mm)") - ) + label=_("Duration (hh:mm)")) class Meta: model = Item @@ -53,19 +52,15 @@ class ItemOrderForm(forms.Form, CssClassMixin): """ weight = forms.ChoiceField( choices=gen_weight_choices(), - widget=forms.Select(attrs={'class': 'menu-weight'}), - ) + widget=forms.Select(attrs={'class': 'menu-weight'})) self = forms.IntegerField( - widget=forms.HiddenInput(attrs={'class': 'menu-mlid'}), - ) + widget=forms.HiddenInput(attrs={'class': 'menu-mlid'})) parent = forms.IntegerField( - widget=forms.HiddenInput(attrs={'class': 'menu-plid'}), - ) + widget=forms.HiddenInput(attrs={'class': 'menu-plid'})) class ConfigForm(CssClassMixin, forms.Form): agenda_start_event_date_time = forms.CharField( widget=forms.DateTimeInput(format='%d.%m.%Y %H:%M'), required=False, - label=_("Begin of event") - ) + label=_("Begin of event")) diff --git a/openslides/agenda/models.py b/openslides/agenda/models.py index 52d2d51b1..a7c27c616 100644 --- a/openslides/agenda/models.py +++ b/openslides/agenda/models.py @@ -20,7 +20,7 @@ from openslides.config.models import config from openslides.projector.projector import SlideMixin from openslides.projector.api import ( register_slidemodel, get_slide_from_sid, register_slidefunc) -from openslides.agenda.slides import agenda_show +from .slides import agenda_show class Item(MPTTModel, SlideMixin): @@ -36,8 +36,7 @@ class Item(MPTTModel, SlideMixin): ITEM_TYPE = ( (AGENDA_ITEM, _('Agenda item')), - (ORGANIZATIONAL_ITEM, _('Organizational item')), - ) + (ORGANIZATIONAL_ITEM, _('Organizational item'))) title = models.CharField(null=True, max_length=255, verbose_name=_("Title")) text = models.TextField(null=True, blank=True, verbose_name=_("Text")) diff --git a/openslides/agenda/urls.py b/openslides/agenda/urls.py index 21be990e6..7ca03dc8f 100644 --- a/openslides/agenda/urls.py +++ b/openslides/agenda/urls.py @@ -19,35 +19,43 @@ urlpatterns = patterns( '', url(r'^$', Overview.as_view(), - name='item_overview', ), + name='item_overview', + ), url(r'^(?P\d+)/$', View.as_view(), - name='item_view', ), + name='item_view', + ), url(r'^(?P\d+)/close/$', SetClosed.as_view(), {'closed': True}, - name='item_close', ), + name='item_close', + ), url(r'^(?P\d+)/open/$', SetClosed.as_view(), {'closed': False}, - name='item_open', ), + name='item_open', + ), url(r'^(?P\d+)/edit/$', ItemUpdate.as_view(), - name='item_edit', ), + name='item_edit', + ), url(r'^new/$', ItemCreate.as_view(), - name='item_new', ), + name='item_new', + ), url(r'^(?P\d+)/del/$', ItemDelete.as_view(), - name='item_delete', ), + name='item_delete', + ), url(r'^print/$', AgendaPDF.as_view(), - name='print_agenda', ), + name='print_agenda', + ), ) diff --git a/openslides/agenda/views.py b/openslides/agenda/views.py index 42356906a..98fbea02a 100644 --- a/openslides/agenda/views.py +++ b/openslides/agenda/views.py @@ -11,6 +11,7 @@ """ from reportlab.platypus import Paragraph +from datetime import datetime, timedelta from django.core.urlresolvers import reverse from django.contrib import messages @@ -31,7 +32,6 @@ from openslides.projector.api import get_active_slide from openslides.projector.projector import Widget, SLIDE from .models import Item from .forms import ItemOrderForm, ItemForm -from datetime import datetime, timedelta class Overview(TemplateView): @@ -71,15 +71,16 @@ class Overview(TemplateView): else: end = start + duration - duration = u'%d:%02d' % ((duration.days * 24 + duration.seconds / 3600), (duration.seconds / 60 % 60)) + duration = u'%d:%02d' % ( + (duration.days * 24 + duration.seconds / 3600.0), + (duration.seconds / 60.0 % 60)) context.update({ 'items': items, 'active_sid': get_active_slide(only_sid=True), 'duration': duration, 'start': start, - 'end': end, - }) + 'end': end}) return context @transaction.commit_manually @@ -140,8 +141,7 @@ class SetClosed(RedirectView, SingleObjectMixin): link = reverse('item_close', args=[self.object.id]) context.update({ 'closed': kwargs['closed'], - 'link': link, - }) + 'link': link}) return context def pre_redirect(self, request, *args, **kwargs): diff --git a/tests/agenda/tests.py b/tests/agenda/tests.py index db4ad3545..d28c5f993 100644 --- a/tests/agenda/tests.py +++ b/tests/agenda/tests.py @@ -182,7 +182,6 @@ class ViewTest(TestCase): data = {'title': 'newitem1', 'text': 'item1-text', 'weight': '0', 'type': 1} response = c.post('/agenda/%d/edit/' % self.item1.id, data) - print response self.assertEqual(response.status_code, 302) self.refreshItems() self.assertEqual(self.item1.title, 'newitem1')