add manager for programs.Diffusion + adapt; list_by_date's date urls; website's section Log algorithm

This commit is contained in:
bkfox
2016-07-18 18:29:24 +02:00
parent 6b7255112d
commit e0edd7fc7d
5 changed files with 127 additions and 113 deletions

View File

@ -1,3 +1,5 @@
import datetime
from django.db import models
from django.utils import timezone as tz
from django.conf.urls import url
@ -176,17 +178,13 @@ class DateRoute(Route):
]
@classmethod
def get_queryset(cl, model, request, year, month, day,
attr='date', **kwargs):
def get_queryset(cl, model, request, year, month, day, **kwargs):
"""
* request: optional
* attr: name of the attribute to check the date against
"""
return model.objects.filter(**{
attr + '__year': int(year),
attr + '__month': int(month),
attr + '__day': int(day)
})
date = datetime.date(int(year), int(month), int(day))
return model.objects.filter(date__contains = date)
@classmethod
def get_title(cl, model, request, year, month, day, **kwargs):