PEP8 errors resolved

This commit is contained in:
Stefan Frauenknecht 2013-02-16 10:41:22 +01:00
parent 488b4285a9
commit 8103c09b81
7 changed files with 72 additions and 44 deletions

View File

@ -10,16 +10,15 @@
:license: GNU GPL, see LICENSE for more details. :license: GNU GPL, see LICENSE for more details.
""" """
import re
from django import forms from django import forms
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from django.contrib.admin.widgets import AdminTimeWidget
from mptt.forms import TreeNodeChoiceField from mptt.forms import TreeNodeChoiceField
from openslides.utils.forms import CssClassMixin from openslides.utils.forms import CssClassMixin
from openslides.agenda.models import Item from openslides.agenda.models import Item
import re
class ItemForm(forms.ModelForm, CssClassMixin): class ItemForm(forms.ModelForm, CssClassMixin):
""" """
@ -63,6 +62,7 @@ class ItemOrderForm(forms.Form, CssClassMixin):
widget=forms.HiddenInput(attrs={'class': 'menu-plid'}), widget=forms.HiddenInput(attrs={'class': 'menu-plid'}),
) )
class ConfigForm(CssClassMixin, forms.Form): class ConfigForm(CssClassMixin, forms.Form):
agenda_start_event_date_time = forms.CharField( agenda_start_event_date_time = forms.CharField(
widget=forms.DateTimeInput(format='%d.%m.%Y %H:%M'), widget=forms.DateTimeInput(format='%d.%m.%Y %H:%M'),

View File

@ -37,7 +37,7 @@ class Item(MPTTModel, SlideMixin):
ITEM_TYPE = ( ITEM_TYPE = (
(AGENDA_ITEM, _('Agenda item')), (AGENDA_ITEM, _('Agenda item')),
(ORGANIZATIONAL_ITEM, _('Organizational item')), (ORGANIZATIONAL_ITEM, _('Organizational item')),
) )
title = models.CharField(null=True, max_length=255, verbose_name=_("Title")) title = models.CharField(null=True, max_length=255, verbose_name=_("Title"))
text = models.TextField(null=True, blank=True, verbose_name=_("Text")) text = models.TextField(null=True, blank=True, verbose_name=_("Text"))
@ -46,11 +46,8 @@ class Item(MPTTModel, SlideMixin):
weight = models.IntegerField(default=0, verbose_name=_("Weight")) weight = models.IntegerField(default=0, verbose_name=_("Weight"))
parent = TreeForeignKey('self', null=True, blank=True, parent = TreeForeignKey('self', null=True, blank=True,
related_name='children') related_name='children')
type = models.IntegerField(max_length=1, choices=ITEM_TYPE, type = models.IntegerField(max_length=1, choices=ITEM_TYPE, default=AGENDA_ITEM, verbose_name=_("Type"))
default=AGENDA_ITEM, verbose_name=_("Type"))
duration = models.CharField(null=True, blank=True, max_length=5, verbose_name=_("Duration (hh:mm)")) duration = models.CharField(null=True, blank=True, max_length=5, verbose_name=_("Duration (hh:mm)"))
related_sid = models.CharField(null=True, blank=True, max_length=63) related_sid = models.CharField(null=True, blank=True, max_length=63)
def get_related_slide(self): def get_related_slide(self):
@ -179,7 +176,6 @@ class Item(MPTTModel, SlideMixin):
def __unicode__(self): def __unicode__(self):
return self.get_title() return self.get_title()
class Meta: class Meta:
permissions = ( permissions = (
('can_see_agenda', ugettext_noop("Can see agenda")), ('can_see_agenda', ugettext_noop("Can see agenda")),

View File

@ -10,7 +10,6 @@ tr.topline td {
background-color: #CDCDCD; background-color: #CDCDCD;
} }
table#agendatime { table#agendatime {
float: right; float: right;
width: auto; width: auto;

View File

@ -1,11 +1,46 @@
/* css for timepicker */ /**
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; } * OpenSlides timepicker style
.ui-timepicker-div dl { text-align: left; } *
.ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; } * :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
.ui-timepicker-div dl dd { margin: 0 10px 10px 65px; } * :license: GNU GPL, see LICENSE for more details.
.ui-timepicker-div td { font-size: 90%; } */
.ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; }
.ui-timepicker-rtl{ direction: rtl; } .ui-timepicker-div .ui-widget-header {
.ui-timepicker-rtl dl { text-align: right; } margin-bottom: 8px;
.ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; } }
.ui-timepicker-div dl {
text-align: left;
}
.ui-timepicker-div dl dt {
height: 25px;
margin-bottom: -25px;
}
.ui-timepicker-div dl dd {
margin: 0 10px 10px 65px;
}
.ui-timepicker-div td {
font-size: 90%;
}
.ui-tpicker-grid-label {
background: none;
border: none;
margin: 0;
padding: 0;
}
.ui-timepicker-rtl{
direction: rtl;
}
.ui-timepicker-rtl dl {
text-align: right;
}
.ui-timepicker-rtl dl dd {
margin: 0 65px 10px 10px;
}

View File

@ -108,7 +108,7 @@
<td class="optional"></td> <td class="optional"></td>
{% endif %} {% endif %}
{% if perms.agenda.can_see_orga_items %} {% if perms.agenda.can_see_orga_items %}
<td>{{duration}}h</td> <td>{{ duration }}h</td>
{% endif %} {% endif %}
{% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %} {% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}
<td> <td>

View File

@ -11,49 +11,43 @@
""" """
from django.conf.urls import url, patterns from django.conf.urls import url, patterns
from openslides.agenda.views import (Overview, View, SetClosed, ItemUpdate, from openslides.agenda.views import (
Overview, View, SetClosed, ItemUpdate,
ItemCreate, ItemDelete, AgendaPDF) ItemCreate, ItemDelete, AgendaPDF)
urlpatterns = patterns('', urlpatterns = patterns(
'',
url(r'^$', url(r'^$',
Overview.as_view(), Overview.as_view(),
name='item_overview', name='item_overview', ),
),
url(r'^(?P<pk>\d+)/$', url(r'^(?P<pk>\d+)/$',
View.as_view(), View.as_view(),
name='item_view', name='item_view', ),
),
url(r'^(?P<pk>\d+)/close/$', url(r'^(?P<pk>\d+)/close/$',
SetClosed.as_view(), SetClosed.as_view(),
{'closed': True}, {'closed': True},
name='item_close', name='item_close', ),
),
url(r'^(?P<pk>\d+)/open/$', url(r'^(?P<pk>\d+)/open/$',
SetClosed.as_view(), SetClosed.as_view(),
{'closed': False}, {'closed': False},
name='item_open', name='item_open', ),
),
url(r'^(?P<pk>\d+)/edit/$', url(r'^(?P<pk>\d+)/edit/$',
ItemUpdate.as_view(), ItemUpdate.as_view(),
name='item_edit', name='item_edit', ),
),
url(r'^new/$', url(r'^new/$',
ItemCreate.as_view(), ItemCreate.as_view(),
name='item_new', name='item_new', ),
),
url(r'^(?P<pk>\d+)/del/$', url(r'^(?P<pk>\d+)/del/$',
ItemDelete.as_view(), ItemDelete.as_view(),
name='item_delete', name='item_delete', ),
),
url(r'^print/$', url(r'^print/$',
AgendaPDF.as_view(), AgendaPDF.as_view(),
name='print_agenda', name='print_agenda', ),
),
) )

View File

@ -9,6 +9,7 @@
:copyright: 2011, 2012 by the OpenSlides team, see AUTHORS. :copyright: 2011, 2012 by the OpenSlides team, see AUTHORS.
:license: GNU GPL, see LICENSE for more details. :license: GNU GPL, see LICENSE for more details.
""" """
from reportlab.platypus import Paragraph from reportlab.platypus import Paragraph
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
@ -40,7 +41,6 @@ class Overview(TemplateView):
permission_required = 'agenda.can_see_agenda' permission_required = 'agenda.can_see_agenda'
template_name = 'agenda/overview.html' template_name = 'agenda/overview.html'
def get_context_data(self, **kwargs): def get_context_data(self, **kwargs):
context = super(Overview, self).get_context_data(**kwargs) context = super(Overview, self).get_context_data(**kwargs)
@ -49,7 +49,7 @@ class Overview(TemplateView):
else: else:
items = Item.objects.filter(type__exact=Item.AGENDA_ITEM) items = Item.objects.filter(type__exact=Item.AGENDA_ITEM)
start = config['agenda_start_event_date_time'] start = config['agenda_start_event_date_time']
if start is None or len(start) == 0: if start is None or len(start) == 0:
start = None start = None
else: else:
@ -68,7 +68,7 @@ class Overview(TemplateView):
if start is None: if start is None:
end = None end = None
else: else:
end = start + duration 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), (duration.seconds / 60 % 60))
@ -193,12 +193,14 @@ class ItemDelete(DeleteView):
if self.get_answer() == 'all': if self.get_answer() == 'all':
self.object.delete(with_children=True) self.object.delete(with_children=True)
messages.success( messages.success(
request, _("Item %s and his children were successfully deleted.") request,
_("Item %s and his children were successfully deleted.")
% html_strong(self.object)) % html_strong(self.object))
elif self.get_answer() == 'yes': elif self.get_answer() == 'yes':
self.object.delete(with_children=False) self.object.delete(with_children=False)
messages.success( messages.success(
request, _("Item %s was successfully deleted.") request,
_("Item %s was successfully deleted.")
% html_strong(self.object)) % html_strong(self.object))
@ -221,6 +223,7 @@ class AgendaPDF(PDFView):
else: else:
story.append(Paragraph(item.get_title(), stylesheet['Item'])) story.append(Paragraph(item.get_title(), stylesheet['Item']))
class Config(FormView): class Config(FormView):
""" """
Config page for the agenda app. Config page for the agenda app.
@ -240,6 +243,7 @@ class Config(FormView):
messages.success(self.request, _('Agenda settings successfully saved.')) messages.success(self.request, _('Agenda settings successfully saved.'))
return super(Config, self).form_valid(form) return super(Config, self).form_valid(form)
def register_tab(request): def register_tab(request):
""" """
register the agenda tab. register the agenda tab.