schedule -- get queryset from routes.DateRoute
This commit is contained in:
parent
733acf20ef
commit
37b807b403
|
@ -88,6 +88,9 @@ class DetailRoute(Route):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_object(cl, model, request, pk, **kwargs):
|
def get_object(cl, model, request, pk, **kwargs):
|
||||||
|
"""
|
||||||
|
* request is optional
|
||||||
|
"""
|
||||||
return model.objects.get(pk = int(pk))
|
return model.objects.get(pk = int(pk))
|
||||||
|
|
||||||
|
|
||||||
|
@ -96,6 +99,9 @@ class AllRoute(Route):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_queryset(cl, model, request, **kwargs):
|
def get_queryset(cl, model, request, **kwargs):
|
||||||
|
"""
|
||||||
|
* request is optional
|
||||||
|
"""
|
||||||
return model.objects.all()
|
return model.objects.all()
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -133,6 +139,9 @@ class ThreadRoute(Route):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_queryset(cl, model, request, thread_model, pk, **kwargs):
|
def get_queryset(cl, model, request, thread_model, pk, **kwargs):
|
||||||
|
"""
|
||||||
|
* request is optional
|
||||||
|
"""
|
||||||
thread = cl.get_thread(model, thread_model, pk)
|
thread = cl.get_thread(model, thread_model, pk)
|
||||||
return model.get_siblings(thread_model = thread, thread_id = pk)
|
return model.get_siblings(thread_model = thread, thread_id = pk)
|
||||||
|
|
||||||
|
@ -161,6 +170,9 @@ class DateRoute(Route):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_queryset(cl, model, request, year, month, day, **kwargs):
|
def get_queryset(cl, model, request, year, month, day, **kwargs):
|
||||||
|
"""
|
||||||
|
* request is optional
|
||||||
|
"""
|
||||||
return model.objects.filter(
|
return model.objects.filter(
|
||||||
date__year = int(year),
|
date__year = int(year),
|
||||||
date__month = int(month),
|
date__month = int(month),
|
||||||
|
@ -188,6 +200,9 @@ class SearchRoute(Route):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_queryset(cl, model, request, q = None, **kwargs):
|
def get_queryset(cl, model, request, q = None, **kwargs):
|
||||||
|
"""
|
||||||
|
* request is required if q is None
|
||||||
|
"""
|
||||||
q = request.GET.get('q') or q or ''
|
q = request.GET.get('q') or q or ''
|
||||||
qs = None
|
qs = None
|
||||||
for search_field in model.search_fields or []:
|
for search_field in model.search_fields or []:
|
||||||
|
|
8
notes.md
8
notes.md
|
@ -7,6 +7,7 @@
|
||||||
- programs:
|
- programs:
|
||||||
- schedule changes -> update later diffusions according to the new schedule
|
- schedule changes -> update later diffusions according to the new schedule
|
||||||
- stream disable -> remote control on liquidsoap
|
- stream disable -> remote control on liquidsoap
|
||||||
|
- users
|
||||||
- tests:
|
- tests:
|
||||||
- sound_monitor
|
- sound_monitor
|
||||||
|
|
||||||
|
@ -18,16 +19,15 @@
|
||||||
- config generation and sound diffusion
|
- config generation and sound diffusion
|
||||||
|
|
||||||
- cms:
|
- cms:
|
||||||
- empty content/list -> nothing
|
|
||||||
- update documentation:
|
- update documentation:
|
||||||
- cms.script
|
- cms.script
|
||||||
- cms.exposure; make it right, see nomenclature, + docstring
|
- cms.exposure; make it right, see nomenclature, + docstring
|
||||||
- cms.actions;
|
- cms.actions;
|
||||||
- admin cms
|
- admin cms
|
||||||
|
-> sections/actions and django decorator?
|
||||||
|
-> enhance calendar with possible actions?
|
||||||
|
|
||||||
- website:
|
- website:
|
||||||
- render schedule does not get the correct list
|
|
||||||
-> postlistview has not the same queryset as website/sections/schedule
|
|
||||||
- diffusions:
|
- diffusions:
|
||||||
- print program's name in lists / clean up that thing also a bit
|
- print program's name in lists / clean up that thing also a bit
|
||||||
- article list with the focus
|
- article list with the focus
|
||||||
|
@ -45,7 +45,7 @@
|
||||||
- player support diffusions with multiple archive files
|
- player support diffusions with multiple archive files
|
||||||
- view as grid
|
- view as grid
|
||||||
- actions -> noscript case, think of accessibility
|
- actions -> noscript case, think of accessibility
|
||||||
- comments edit/remove by the poster
|
- comments -> remove/edit by the author
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -292,17 +292,10 @@ class Schedule(Diffusions):
|
||||||
|
|
||||||
def get_object_list(self):
|
def get_object_list(self):
|
||||||
date = self.date_or_default()
|
date = self.date_or_default()
|
||||||
year, month, day = date.year, date.month, date.day
|
return routes.DateRoute.get_queryset(
|
||||||
|
models.Diffusion, self.request, date.year, date.month,
|
||||||
diffs = [d.initial if d.initial else d
|
date.day
|
||||||
for d in programs.Diffusion.objects.filter(
|
).order_by('date')
|
||||||
start__year = year,
|
|
||||||
start__month = month,
|
|
||||||
start__day = day,
|
|
||||||
)
|
|
||||||
]
|
|
||||||
return models.Diffusion.objects.filter(related__in = diffs). \
|
|
||||||
order_by('date')
|
|
||||||
|
|
||||||
def get_context_data(self, *args, **kwargs):
|
def get_context_data(self, *args, **kwargs):
|
||||||
context = super().get_context_data(*args, **kwargs)
|
context = super().get_context_data(*args, **kwargs)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user