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