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.
"""
import re
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.admin.widgets import AdminTimeWidget
from mptt.forms import TreeNodeChoiceField
from openslides.utils.forms import CssClassMixin
from openslides.agenda.models import Item
import re
class ItemForm(forms.ModelForm, CssClassMixin):
"""
@ -63,6 +62,7 @@ class ItemOrderForm(forms.Form, CssClassMixin):
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'),

View File

@ -37,7 +37,7 @@ class Item(MPTTModel, SlideMixin):
ITEM_TYPE = (
(AGENDA_ITEM, _('Agenda 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"))
@ -46,11 +46,8 @@ class Item(MPTTModel, SlideMixin):
weight = models.IntegerField(default=0, verbose_name=_("Weight"))
parent = TreeForeignKey('self', null=True, blank=True,
related_name='children')
type = models.IntegerField(max_length=1, choices=ITEM_TYPE,
default=AGENDA_ITEM, verbose_name=_("Type"))
type = models.IntegerField(max_length=1, choices=ITEM_TYPE, default=AGENDA_ITEM, verbose_name=_("Type"))
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)
def get_related_slide(self):
@ -179,7 +176,6 @@ class Item(MPTTModel, SlideMixin):
def __unicode__(self):
return self.get_title()
class Meta:
permissions = (
('can_see_agenda', ugettext_noop("Can see agenda")),

View File

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

View File

@ -1,11 +1,46 @@
/* css for timepicker */
.ui-timepicker-div .ui-widget-header { margin-bottom: 8px; }
.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; }
/**
* OpenSlides timepicker style
*
* :copyright: 2011, 2012 by OpenSlides team, see AUTHORS.
* :license: GNU GPL, see LICENSE for more details.
*/
.ui-timepicker-rtl{ direction: rtl; }
.ui-timepicker-rtl dl { text-align: right; }
.ui-timepicker-rtl dl dd { margin: 0 65px 10px 10px; }
.ui-timepicker-div .ui-widget-header {
margin-bottom: 8px;
}
.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>
{% endif %}
{% if perms.agenda.can_see_orga_items %}
<td>{{duration}}h</td>
<td>{{ duration }}h</td>
{% endif %}
{% if perms.agenda.can_manage_agenda or perms.projector.can_manage_projector %}
<td>

View File

@ -11,49 +11,43 @@
"""
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)
urlpatterns = patterns('',
urlpatterns = patterns(
'',
url(r'^$',
Overview.as_view(),
name='item_overview',
),
name='item_overview', ),
url(r'^(?P<pk>\d+)/$',
View.as_view(),
name='item_view',
),
name='item_view', ),
url(r'^(?P<pk>\d+)/close/$',
SetClosed.as_view(),
{'closed': True},
name='item_close',
),
name='item_close', ),
url(r'^(?P<pk>\d+)/open/$',
SetClosed.as_view(),
{'closed': False},
name='item_open',
),
name='item_open', ),
url(r'^(?P<pk>\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<pk>\d+)/del/$',
ItemDelete.as_view(),
name='item_delete',
),
name='item_delete', ),
url(r'^print/$',
AgendaPDF.as_view(),
name='print_agenda',
),
name='print_agenda', ),
)

View File

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