flake8 fixes
This commit is contained in:
parent
51709c6eaf
commit
0ebcc2f124
4 changed files with 12 additions and 9 deletions
|
@ -102,7 +102,7 @@ class Slot(models.Model):
|
|||
self.day.date.day,
|
||||
self.start.hour,
|
||||
self.start.minute)
|
||||
|
||||
|
||||
@property
|
||||
def end_datetime(self):
|
||||
return datetime.datetime(
|
||||
|
@ -111,12 +111,12 @@ class Slot(models.Model):
|
|||
self.day.date.day,
|
||||
self.end.hour,
|
||||
self.end.minute)
|
||||
|
||||
|
||||
@property
|
||||
def length_in_minutes(self):
|
||||
return int(
|
||||
(self.end_datetime - self.start_datetime).total_seconds() / 60)
|
||||
|
||||
|
||||
@property
|
||||
def rooms(self):
|
||||
return Room.objects.filter(pk__in=self.slotroom_set.values("room"))
|
||||
|
|
|
@ -11,8 +11,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)))
|
||||
#timezone = TimeZoneField("UTC")
|
||||
end_date = fuzzy.FuzzyDate(datetime.date(2014, 1, 1)
|
||||
+ datetime.timedelta(days=random.randint(1, 10)))
|
||||
# timezone = TimeZoneField("UTC")
|
||||
|
||||
class Meta:
|
||||
model = Conference
|
||||
|
@ -55,8 +56,8 @@ class DayFactory(factory.DjangoModelFactory):
|
|||
class SlotFactory(factory.DjangoModelFactory):
|
||||
day = factory.SubFactory(DayFactory)
|
||||
kind = factory.SubFactory(SlotKindFactory)
|
||||
start = datetime.time(random.randint(0,23), random.randint(0,59))
|
||||
end = 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))
|
||||
|
||||
class Meta:
|
||||
model = Slot
|
||||
|
|
|
@ -17,7 +17,6 @@ class ScheduleViewTests(TestCase):
|
|||
assert 'schedule' in conference
|
||||
assert len(conference['schedule']) == 0
|
||||
|
||||
|
||||
def test_populated_empty_presentations(self):
|
||||
|
||||
factories.SlotFactory.create_batch(size=5)
|
||||
|
|
|
@ -164,7 +164,10 @@ def schedule_presentation_detail(request, pk):
|
|||
|
||||
|
||||
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')
|
||||
data = []
|
||||
|
|
Loading…
Reference in a new issue