From 48ce4ba473800ddce1fa1e1d37a80d7d33eaec64 Mon Sep 17 00:00:00 2001 From: Hidden Z Date: Sat, 20 Nov 2010 13:04:37 +0000 Subject: [PATCH] Move {days,hosts}_count from urls to settings --- pyi2phosts/settings.py | 2 ++ pyi2phosts/urls.py | 12 +++++------- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/pyi2phosts/settings.py b/pyi2phosts/settings.py index c8db81e..13430c5 100644 --- a/pyi2phosts/settings.py +++ b/pyi2phosts/settings.py @@ -111,6 +111,8 @@ MY_B64 = 'my_base64_hash' # also may be put in local settings: LOG_LEVEL = 'debug' LOG_FILE = '/var/log/py-i2phosts/web.log' +LATEST_DAY_COUNT = 30 +LATEST_HOSTS_COUNT = 40 # include local settings diff --git a/pyi2phosts/urls.py b/pyi2phosts/urls.py index 3e681de..7024034 100644 --- a/pyi2phosts/urls.py +++ b/pyi2phosts/urls.py @@ -31,21 +31,18 @@ browse_hosts = { } } -# FIXME: move to settings -day_count = 30 -hosts_count = 40 now_date = datetime.datetime.utcnow() -start_date = now_date - datetime.timedelta(days=day_count) +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")[: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, 'extra_context': { 'title': settings.SITE_NAME, - 'day_count': day_count, - 'hosts_count': hosts_count, + 'day_count': settings.LATEST_DAY_COUNT, + 'hosts_count': settings.LATEST_HOSTS_COUNT, } } @@ -62,6 +59,7 @@ urlpatterns = patterns('', url(r'^faq/$', object_list, extsources, name='faq'), url(r'^browse/$', object_list, browse_hosts, name='browse'), url(r'^latest/$', object_list, latest_hosts, name='latest'), + (r'^search/$', include('pyi2phosts.search.urls')), (r'^postkey/', include('pyi2phosts.postkey.urls')), (r'^jump/', include('pyi2phosts.jump.urls')),