Compare commits
No commits in common. "e94aeb244069389e047e2bf30943c1fe4c6311f8" and "a805ce67779d17dfe24873da854da0c5208c2d83" have entirely different histories.
e94aeb2440
...
a805ce6777
|
@ -127,6 +127,7 @@ class Program(Page):
|
|||
|
||||
def save(self, *kargs, **kwargs):
|
||||
from .sound import Sound
|
||||
|
||||
super().save(*kargs, **kwargs)
|
||||
|
||||
# TODO: move in signals
|
||||
|
|
|
@ -1,8 +1,6 @@
|
|||
from collections import deque
|
||||
import datetime
|
||||
|
||||
from django.utils.decorators import method_decorator
|
||||
from django.views.decorators.cache import cache_page
|
||||
from django.views.generic import ListView
|
||||
from django.utils import timezone as tz
|
||||
|
||||
|
@ -93,10 +91,6 @@ class LogListAPIView(LogListMixin, BaseAPIView, ListAPIView):
|
|||
serializer_class = LogInfoSerializer
|
||||
queryset = Log.objects.all()
|
||||
|
||||
@method_decorator(cache_page(5))
|
||||
def list(self, *args, **kwargs):
|
||||
return super().list(*args, **kwargs)
|
||||
|
||||
def get_date(self):
|
||||
date = super().get_date()
|
||||
if date is None:
|
||||
|
|
|
@ -122,17 +122,10 @@ class Monitor:
|
|||
self.handle_diffusions()
|
||||
self.sync()
|
||||
|
||||
__last_log_kwargs = None
|
||||
|
||||
def log(self, **kwargs):
|
||||
def log(self, date=None, **kwargs):
|
||||
""" Create a log using **kwargs, and print info """
|
||||
if self.__last_log_kwargs == kwargs:
|
||||
return
|
||||
|
||||
self.__last_log_kwargs = kwargs
|
||||
kwargs.setdefault('station', self.station)
|
||||
kwargs.setdefault('date', tz.now())
|
||||
log = Log(**kwargs)
|
||||
log = Log(date=date or tz.now(), **kwargs)
|
||||
log.save()
|
||||
log.print()
|
||||
return log
|
||||
|
|
Loading…
Reference in New Issue
Block a user