forked from rc/aircox
continue fixes on timezone bug
This commit is contained in:
parent
c39ad228d7
commit
3cceb65121
|
@ -37,7 +37,7 @@ class RelatedManager(models.Manager):
|
||||||
if not model and object:
|
if not model and object:
|
||||||
model = type(object)
|
model = type(object)
|
||||||
|
|
||||||
qs = qs or self
|
qs = self if qs is None else qs
|
||||||
if hasattr(model, '__iter__'):
|
if hasattr(model, '__iter__'):
|
||||||
model = [ ContentType.objects.get_for_model(m).id
|
model = [ ContentType.objects.get_for_model(m).id
|
||||||
for m in model ]
|
for m in model ]
|
||||||
|
@ -338,7 +338,7 @@ class Station(Nameable):
|
||||||
|
|
||||||
class ProgramManager(models.Manager):
|
class ProgramManager(models.Manager):
|
||||||
def station(self, station, qs = None):
|
def station(self, station, qs = None):
|
||||||
qs = qs or self
|
qs = self if qs is None else qs
|
||||||
return qs.filter(station = station)
|
return qs.filter(station = station)
|
||||||
|
|
||||||
class Program(Nameable):
|
class Program(Nameable):
|
||||||
|
@ -717,7 +717,7 @@ class Schedule(models.Model):
|
||||||
|
|
||||||
class DiffusionManager(models.Manager):
|
class DiffusionManager(models.Manager):
|
||||||
def station(self, station, qs = None):
|
def station(self, station, qs = None):
|
||||||
qs = qs or self
|
qs = self if qs is None else qs
|
||||||
return qs.filter(program__station = station)
|
return qs.filter(program__station = station)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
@ -749,7 +749,7 @@ class DiffusionManager(models.Manager):
|
||||||
# note: we work with localtime
|
# note: we work with localtime
|
||||||
date = utils.date_or_default(date, keep_type = True)
|
date = utils.date_or_default(date, keep_type = True)
|
||||||
|
|
||||||
qs = qs or self
|
qs = self if qs is None else qs
|
||||||
filters = None
|
filters = None
|
||||||
if isinstance(date, datetime.datetime):
|
if isinstance(date, datetime.datetime):
|
||||||
# use datetime: we want diffusion that occurs around this
|
# use datetime: we want diffusion that occurs around this
|
||||||
|
@ -789,7 +789,7 @@ class DiffusionManager(models.Manager):
|
||||||
date.
|
date.
|
||||||
"""
|
"""
|
||||||
date = utils.date_or_default(date)
|
date = utils.date_or_default(date)
|
||||||
qs = qs or self
|
qs = self if qs is None else qs
|
||||||
return self.station(station, qs).filter(
|
return self.station(station, qs).filter(
|
||||||
end__lte = date,
|
end__lte = date,
|
||||||
).order_by('start')
|
).order_by('start')
|
||||||
|
@ -1203,7 +1203,7 @@ class Port (models.Model):
|
||||||
|
|
||||||
class LogManager(RelatedManager):
|
class LogManager(RelatedManager):
|
||||||
def station(self, station, qs = None):
|
def station(self, station, qs = None):
|
||||||
qs = qs or self
|
qs = self if qs is None else qs
|
||||||
return qs.filter(station = station)
|
return qs.filter(station = station)
|
||||||
|
|
||||||
def get_for(self, station, *args, **kwargs):
|
def get_for(self, station, *args, **kwargs):
|
||||||
|
@ -1212,7 +1212,7 @@ class LogManager(RelatedManager):
|
||||||
|
|
||||||
def _at(self, date = None, qs = None):
|
def _at(self, date = None, qs = None):
|
||||||
start, end = utils.date_range(date)
|
start, end = utils.date_range(date)
|
||||||
qs = qs or self
|
qs = self if qs is None else qs
|
||||||
return qs.filter(date__gte = start,
|
return qs.filter(date__gte = start,
|
||||||
date__lte = end)
|
date__lte = end)
|
||||||
|
|
||||||
|
|
|
@ -577,6 +577,9 @@ class DiffusionPage(Publication):
|
||||||
Return a list of podcasts, with archive as the first item of the
|
Return a list of podcasts, with archive as the first item of the
|
||||||
list when available.
|
list when available.
|
||||||
"""
|
"""
|
||||||
|
if not self.diffusion:
|
||||||
|
return
|
||||||
|
|
||||||
podcasts = []
|
podcasts = []
|
||||||
archive = self.get_archive()
|
archive = self.get_archive()
|
||||||
if archive:
|
if archive:
|
||||||
|
|
5
notes.md
5
notes.md
|
@ -42,8 +42,9 @@ cms:
|
||||||
# Timezone shit:
|
# Timezone shit:
|
||||||
- run tests:
|
- run tests:
|
||||||
- streamer: dealer & streams hours (to localtime)
|
- streamer: dealer & streams hours (to localtime)
|
||||||
- diffusions: update & check
|
- diffusions: update & check algorithms
|
||||||
- check in templates
|
x check in templates
|
||||||
|
x diffusion page date info
|
||||||
|
|
||||||
# Instance's TODO
|
# Instance's TODO
|
||||||
- menu_top .sections:
|
- menu_top .sections:
|
||||||
|
|
|
@ -13,4 +13,5 @@ Pillow>=3.3.0
|
||||||
django-modelcluster==2.0
|
django-modelcluster==2.0
|
||||||
django-honeypot>=0.5.0
|
django-honeypot>=0.5.0
|
||||||
django-jet>=1.0.3
|
django-jet>=1.0.3
|
||||||
|
mutagen>=1.37
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user