Fix some flake8 issues

This commit is contained in:
Patrick Altman 2015-09-13 21:34:40 -05:00
parent d23363621b
commit 6dd80f9ddb
4 changed files with 15 additions and 6 deletions

View file

@ -28,6 +28,7 @@ class SlotAdmin(admin.ModelAdmin):
list_display = ("day", "start", "end", "kind", "content")
inlines = [SlotRoomInline]
class RoomAdmin(admin.ModelAdmin):
list_display = ["name", "order", "schedule"]
list_filter = ["schedule"]

View file

@ -2,6 +2,7 @@ import datetime
import random
import factory
from factory import fuzzy
from symposion.schedule.models import Schedule, Day, Slot, SlotKind
@ -11,8 +12,9 @@ from symposion.conference.models import Section, Conference
class ConferenceFactory(factory.DjangoModelFactory):
title = fuzzy.FuzzyText()
start_date = fuzzy.FuzzyDate(datetime.date(2014, 1, 1))
end_date = fuzzy.FuzzyDate(datetime.date(2014, 1, 1)
+ datetime.timedelta(days=random.randint(1, 10)))
end_date = fuzzy.FuzzyDate(
datetime.date(2014, 1, 1) + datetime.timedelta(days=random.randint(1, 10))
)
# timezone = TimeZoneField("UTC")
class Meta:

View file

@ -1,10 +1,11 @@
from __future__ import unicode_literals
from django.contrib import admin
from django.utils.html import escape
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
from django.contrib import admin
from symposion.sponsorship.models import (
Benefit,
BENEFITS,
@ -14,6 +15,7 @@ from symposion.sponsorship.models import (
SponsorLevel,
)
class BenefitLevelInline(admin.TabularInline):
model = BenefitLevel
extra = 0

View file

@ -314,10 +314,14 @@ class SponsorBenefit(models.Model):
return ["text"]
return []
def _is_text_benefit(self):
return self.benefit.type in ["text", "richtext", "simple"] and bool(self.text)
def _is_upload_benefit(self):
return self.benefit.type in ["file", "weblogo"] and bool(self.upload)
def _is_complete(self):
return self.active and \
((self.benefit.type in ('text', 'richtext', 'simple') and bool(self.text))
or (self.benefit.type in ('file', 'weblogo') and bool(self.upload)))
return self.active and (self._is_text_benefit() or self._is_upload_benefit())
def _denorm_weblogo(sender, instance, created, **kwargs):