diff options
author | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2014-04-29 22:22:00 (GMT) |
---|---|---|
committer | Ernesto Rico-Schmidt <e.rico.schmidt@gmail.com> | 2014-04-29 22:22:00 (GMT) |
commit | ac251a798769bc5909d25a1f95a98822d46bfbb8 (patch) | |
tree | 46e3753599dbe8e02d6299a557ba707bedbd3acc /program/templatetags/timeslots.py | |
parent | 185a79985c93c44e058ab4bf0345d2dafc4148ee (diff) |
pep8-ized code
Diffstat (limited to 'program/templatetags/timeslots.py')
-rw-r--r-- | program/templatetags/timeslots.py | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/program/templatetags/timeslots.py b/program/templatetags/timeslots.py index 902de36..c2c44b5 100644 --- a/program/templatetags/timeslots.py +++ b/program/templatetags/timeslots.py @@ -4,19 +4,22 @@ register = template.Library() from datetime import datetime, time, timedelta + @register.simple_tag def duration(start, end): return 'style="height: %dpx"' % ((end-start).seconds/60) + @register.simple_tag def duration_until(end): - start = datetime.combine(end.date(), time(6,0)) + start = datetime.combine(end.date(), time(6, 0)) return 'style="height: %dpx"' % ((end-start).seconds/60) + @register.simple_tag def duration_since(start): - if start.time() < time(23,59): - end = datetime.combine(start.date()+timedelta(days=1), time(6,0)) + if start.time() < time(23, 59): + end = datetime.combine(start.date()+timedelta(days=1), time(6, 0)) else: - end = datetime.combine(start.date(), time(6,0)) - return 'style="height: %dpx"' % ((end-start).seconds/60)
\ No newline at end of file + end = datetime.combine(start.date(), time(6, 0)) + return 'style="height: %dpx"' % ((end-start).seconds/60) |