From ee3ec3d4b6c5cd1e5c0a7257306fd34f707f11e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Norman=20J=C3=A4ckel?= Date: Thu, 27 Mar 2014 20:38:13 +0100 Subject: [PATCH] Fixed flake8 errors. --- openslides/agenda/views.py | 2 +- openslides/assignment/models.py | 2 +- openslides/assignment/views.py | 2 +- openslides/mediafile/forms.py | 2 +- openslides/motion/models.py | 20 ++++++++++---------- openslides/motion/views.py | 2 +- openslides/participant/forms.py | 2 +- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/openslides/agenda/views.py b/openslides/agenda/views.py index ae2fb286c..fe2af34c8 100644 --- a/openslides/agenda/views.py +++ b/openslides/agenda/views.py @@ -70,7 +70,7 @@ class Overview(TemplateView): if minutes < 10: minutes = "%s%s" % (0, minutes) item.duration = "%s:%s" % (hours, minutes) - if not start is None: + if start is not None: item.tooltip = start + duration if start is None: diff --git a/openslides/assignment/models.py b/openslides/assignment/models.py index 67f75c93e..de82dbdd2 100644 --- a/openslides/assignment/models.py +++ b/openslides/assignment/models.py @@ -178,7 +178,7 @@ class Assignment(SlideMixin, models.Model): participants.append(candidate.person) participants.sort(key=lambda person: person.sort_name) return participants - #return candidates.values_list('person', flat=True) + # return candidates.values_list('person', flat=True) def set_elected(self, person, value=True): candidate = self.assignment_candidates.get(person=person) diff --git a/openslides/assignment/views.py b/openslides/assignment/views.py index 9fd602094..3037394d1 100644 --- a/openslides/assignment/views.py +++ b/openslides/assignment/views.py @@ -221,7 +221,7 @@ class PollUpdateView(PollFormView): def get_success_url(self): return_url = '' - if not 'apply' in self.request.POST: + if 'apply' not in self.request.POST: return_url = reverse('assignment_detail', args=[self.poll.assignment.id]) return return_url diff --git a/openslides/mediafile/forms.py b/openslides/mediafile/forms.py index 9b684b8a9..fb129d304 100644 --- a/openslides/mediafile/forms.py +++ b/openslides/mediafile/forms.py @@ -29,7 +29,7 @@ class MediafileUpdateForm(CssClassMixin, ModelForm): """ Method to save the form. Here the overwrite is to delete old files. """ - if not self.instance.pk is None: + if self.instance.pk is not None: old_file = Mediafile.objects.get(pk=self.instance.pk).mediafile if not old_file == self.instance.mediafile: old_file.delete() diff --git a/openslides/motion/models.py b/openslides/motion/models.py index cdb7c4d02..37316293b 100644 --- a/openslides/motion/models.py +++ b/openslides/motion/models.py @@ -72,7 +72,7 @@ class Motion(SlideMixin, models.Model): """ # TODO: proposal - #master = models.ForeignKey('self', null=True, blank=True) + # master = models.ForeignKey('self', null=True, blank=True) class Meta: permissions = ( @@ -542,8 +542,8 @@ class MotionVersion(models.Model): creation_time = models.DateTimeField(auto_now=True) """Time when the version was saved.""" - #identifier = models.CharField(max_length=255, verbose_name=ugettext_lazy("Version identifier")) - #note = models.TextField(null=True, blank=True) + # identifier = models.CharField(max_length=255, verbose_name=ugettext_lazy("Version identifier")) + # note = models.TextField(null=True, blank=True) class Meta: unique_together = ("motion", "version_number") @@ -625,11 +625,11 @@ class Category(models.Model): class Meta: ordering = ['prefix'] -## class Comment(models.Model): - ## motion_version = models.ForeignKey(MotionVersion) - ## text = models.TextField() - ## author = PersonField() - ## creation_time = models.DateTimeField(auto_now=True) +# class Comment(models.Model): + # motion_version = models.ForeignKey(MotionVersion) + # text = models.TextField() + # author = PersonField() + # creation_time = models.DateTimeField(auto_now=True) class MotionLog(models.Model): @@ -727,8 +727,8 @@ class MotionPoll(RelatedModelMixin, CountInvalid, CountVotesCast, BasePoll): def set_options(self): """Create the option class for this poll.""" - #TODO: maybe it is possible with .create() to call this without poll=self - # or call this in save() + # TODO: maybe it is possible with .create() to call this without poll=self + # or call this in save() self.get_option_class()(poll=self).save() def append_pollform_fields(self, fields): diff --git a/openslides/motion/views.py b/openslides/motion/views.py index 5bc0221ed..4fd19cd9c 100644 --- a/openslides/motion/views.py +++ b/openslides/motion/views.py @@ -183,7 +183,7 @@ class MotionCreateView(MotionEditMixin, CreateView): """ response = super(MotionCreateView, self).form_valid(form) self.object.write_log([ugettext_noop('Motion created')], self.request.user) - if (not 'submitter' in form.cleaned_data or + if ('submitter' not in form.cleaned_data or not form.cleaned_data['submitter']): self.object.add_submitter(self.request.user) return response diff --git a/openslides/participant/forms.py b/openslides/participant/forms.py index 4724c8f2b..8bde79a8c 100644 --- a/openslides/participant/forms.py +++ b/openslides/participant/forms.py @@ -127,7 +127,7 @@ class GroupForm(forms.ModelForm, CssClassMixin): # TODO: Check this in clean_users or clean_permissions if (self.request and not self.request.user.is_superuser and - not self.request.user in self.cleaned_data['users'] and + self.request.user not in self.cleaned_data['users'] and not Group.objects.exclude(pk=self.instance.pk).filter( permissions__in=[get_protected_perm()], user__pk=self.request.user.pk).exists()):