1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-02-08 12:54:23 +00:00

Revert "pyi2phosts/urls.py: use separate functions to get dates"

This reverts commit 3c193bcdc3b7cfbf5f4b855d7cdd9931ef565ba1.

This patch doesn't solves the problem. We need django 1.3 or workaround
like described here:
http://pascut.com/2008/08/16/django-generic-views-cache-behavior/
This commit is contained in:
Hidden Z 2010-11-26 19:06:40 +00:00
parent a48e4a998e
commit efa9397a9c

View File

@ -12,12 +12,6 @@ from pyi2phosts.extsources.models import ExternalSource
from pyi2phosts.postkey.models import i2phost
import settings
def now_date():
return datetime.datetime.utcnow()
def start_date():
return now_date() - datetime.timedelta(days=settings.LATEST_DAY_COUNT)
extsources = {
'queryset': ExternalSource.objects.filter(active=True),
'template_name': 'faq.html',
@ -37,9 +31,11 @@ browse_hosts = {
}
}
now_date = datetime.datetime.utcnow()
start_date = now_date - datetime.timedelta(days=settings.LATEST_DAY_COUNT)
latest_hosts = {
'queryset': i2phost.objects.filter(activated=True,
date_added__range=(start_date(), now_date())).order_by("-date_added")[:settings.LATEST_HOSTS_COUNT],
date_added__range=(start_date, now_date)).order_by("-date_added")[:settings.LATEST_HOSTS_COUNT],
'template_name': 'latest.html',
'template_object_name': 'host',
'paginate_by': 40,