flake8 fixes

This commit is contained in:
Sheila Miguez 2014-09-21 21:11:12 -05:00
parent 51709c6eaf
commit 0ebcc2f124
4 changed files with 12 additions and 9 deletions

View file

@ -102,7 +102,7 @@ class Slot(models.Model):
self.day.date.day, self.day.date.day,
self.start.hour, self.start.hour,
self.start.minute) self.start.minute)
@property @property
def end_datetime(self): def end_datetime(self):
return datetime.datetime( return datetime.datetime(
@ -111,12 +111,12 @@ class Slot(models.Model):
self.day.date.day, self.day.date.day,
self.end.hour, self.end.hour,
self.end.minute) self.end.minute)
@property @property
def length_in_minutes(self): def length_in_minutes(self):
return int( return int(
(self.end_datetime - self.start_datetime).total_seconds() / 60) (self.end_datetime - self.start_datetime).total_seconds() / 60)
@property @property
def rooms(self): def rooms(self):
return Room.objects.filter(pk__in=self.slotroom_set.values("room")) return Room.objects.filter(pk__in=self.slotroom_set.values("room"))

View file

@ -11,8 +11,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) + datetime.timedelta(days=random.randint(1,10))) end_date = fuzzy.FuzzyDate(datetime.date(2014, 1, 1)
#timezone = TimeZoneField("UTC") + datetime.timedelta(days=random.randint(1, 10)))
# timezone = TimeZoneField("UTC")
class Meta: class Meta:
model = Conference model = Conference
@ -55,8 +56,8 @@ class DayFactory(factory.DjangoModelFactory):
class SlotFactory(factory.DjangoModelFactory): class SlotFactory(factory.DjangoModelFactory):
day = factory.SubFactory(DayFactory) day = factory.SubFactory(DayFactory)
kind = factory.SubFactory(SlotKindFactory) kind = factory.SubFactory(SlotKindFactory)
start = datetime.time(random.randint(0,23), random.randint(0,59)) start = datetime.time(random.randint(0, 23), random.randint(0, 59))
end = datetime.time(random.randint(0,23), random.randint(0,59)) end = datetime.time(random.randint(0, 23), random.randint(0, 59))
class Meta: class Meta:
model = Slot model = Slot

View file

@ -17,7 +17,6 @@ class ScheduleViewTests(TestCase):
assert 'schedule' in conference assert 'schedule' in conference
assert len(conference['schedule']) == 0 assert len(conference['schedule']) == 0
def test_populated_empty_presentations(self): def test_populated_empty_presentations(self):
factories.SlotFactory.create_batch(size=5) factories.SlotFactory.create_batch(size=5)

View file

@ -164,7 +164,10 @@ def schedule_presentation_detail(request, pk):
def schedule_json(request): def schedule_json(request):
slots = Slot.objects.filter(day__schedule__published=True, day__schedule__hidden=False).order_by("start") slots = Slot.objects.filter(
day__schedule__published=True,
day__schedule__hidden=False
).order_by("start")
protocol = request.META.get('HTTP_X_FORWARDED_PROTO', 'http') protocol = request.META.get('HTTP_X_FORWARDED_PROTO', 'http')
data = [] data = []