Fix some flake8 issues
This commit is contained in:
parent
d23363621b
commit
6dd80f9ddb
4 changed files with 15 additions and 6 deletions
|
@ -28,6 +28,7 @@ class SlotAdmin(admin.ModelAdmin):
|
||||||
list_display = ("day", "start", "end", "kind", "content")
|
list_display = ("day", "start", "end", "kind", "content")
|
||||||
inlines = [SlotRoomInline]
|
inlines = [SlotRoomInline]
|
||||||
|
|
||||||
|
|
||||||
class RoomAdmin(admin.ModelAdmin):
|
class RoomAdmin(admin.ModelAdmin):
|
||||||
list_display = ["name", "order", "schedule"]
|
list_display = ["name", "order", "schedule"]
|
||||||
list_filter = ["schedule"]
|
list_filter = ["schedule"]
|
||||||
|
|
|
@ -2,6 +2,7 @@ import datetime
|
||||||
import random
|
import random
|
||||||
|
|
||||||
import factory
|
import factory
|
||||||
|
|
||||||
from factory import fuzzy
|
from factory import fuzzy
|
||||||
|
|
||||||
from symposion.schedule.models import Schedule, Day, Slot, SlotKind
|
from symposion.schedule.models import Schedule, Day, Slot, SlotKind
|
||||||
|
@ -11,8 +12,9 @@ from symposion.conference.models import Section, Conference
|
||||||
class ConferenceFactory(factory.DjangoModelFactory):
|
class ConferenceFactory(factory.DjangoModelFactory):
|
||||||
title = fuzzy.FuzzyText()
|
title = fuzzy.FuzzyText()
|
||||||
start_date = fuzzy.FuzzyDate(datetime.date(2014, 1, 1))
|
start_date = fuzzy.FuzzyDate(datetime.date(2014, 1, 1))
|
||||||
end_date = fuzzy.FuzzyDate(datetime.date(2014, 1, 1)
|
end_date = fuzzy.FuzzyDate(
|
||||||
+ datetime.timedelta(days=random.randint(1, 10)))
|
datetime.date(2014, 1, 1) + datetime.timedelta(days=random.randint(1, 10))
|
||||||
|
)
|
||||||
# timezone = TimeZoneField("UTC")
|
# timezone = TimeZoneField("UTC")
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django.contrib import admin
|
|
||||||
from django.utils.html import escape
|
from django.utils.html import escape
|
||||||
from django.utils.safestring import mark_safe
|
from django.utils.safestring import mark_safe
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
|
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
from symposion.sponsorship.models import (
|
from symposion.sponsorship.models import (
|
||||||
Benefit,
|
Benefit,
|
||||||
BENEFITS,
|
BENEFITS,
|
||||||
|
@ -14,6 +15,7 @@ from symposion.sponsorship.models import (
|
||||||
SponsorLevel,
|
SponsorLevel,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class BenefitLevelInline(admin.TabularInline):
|
class BenefitLevelInline(admin.TabularInline):
|
||||||
model = BenefitLevel
|
model = BenefitLevel
|
||||||
extra = 0
|
extra = 0
|
||||||
|
|
|
@ -314,10 +314,14 @@ class SponsorBenefit(models.Model):
|
||||||
return ["text"]
|
return ["text"]
|
||||||
return []
|
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):
|
def _is_complete(self):
|
||||||
return self.active and \
|
return self.active and (self._is_text_benefit() or self._is_upload_benefit())
|
||||||
((self.benefit.type in ('text', 'richtext', 'simple') and bool(self.text))
|
|
||||||
or (self.benefit.type in ('file', 'weblogo') and bool(self.upload)))
|
|
||||||
|
|
||||||
|
|
||||||
def _denorm_weblogo(sender, instance, created, **kwargs):
|
def _denorm_weblogo(sender, instance, created, **kwargs):
|
||||||
|
|
Loading…
Reference in a new issue