import os
import stat
import time
-import urlparse
from django.core.urlresolvers import reverse
from django.conf import settings
from django.http import Http404, JsonResponse
+from django.utils.encoding import force_text
+from django.utils.encoding import python_2_unicode_compatible
+from django.utils.six.moves.urllib import parse as urlparse
from django.views.decorators.cache import cache_control
from django.views.generic.base import TemplateView
from django.views.generic.detail import DetailView
program = ProgramView.as_view()
+@python_2_unicode_compatible
class TimeCell:
nonstop = None
w = 1
end_time.minute)
self.schedules.append(schedule)
- def __unicode__(self):
+ def __str__(self):
if self.schedules:
return ', '.join([x.emission.title for x in self.schedules])
else:
return self.nonstop
def __eq__(self, other):
- return (unicode(self) == unicode(other) and self.time_label == other.time_label)
+ return (force_text(self) == force_text(other) and self.time_label == other.time_label)
class Grid(TemplateView):
continue
# here it is, same cell, same emission, several
# schedules
- schedule_list.sort(lambda x,y: cmp(x.get_duration(), y.get_duration()))
+ schedule_list.sort(key=lambda x: x.get_duration())
schedule = schedule_list[0]
end_time = schedule.datetime + timedelta(
grid[i][j].time_label = same_cell_below.time_label
# then we sort emissions so the longest are
# put first
- grid[i][j].schedules.sort(
- lambda x, y: -cmp(x.get_duration(), y.get_duration()))
+ grid[i][j].schedules.sort(key=lambda x: -x.get_duration())
# then we add individual time labels to the
# other schedules
for schedule in current_cell_schedules: