|
|
|
@ -1,3 +1,4 @@
@@ -1,3 +1,4 @@
|
|
|
|
|
import datetime |
|
|
|
|
from django.conf.urls.defaults import * |
|
|
|
|
from django.views.generic.simple import direct_to_template |
|
|
|
|
from django.views.generic.list_detail import object_list |
|
|
|
@ -30,6 +31,23 @@ browse_hosts = {
@@ -30,6 +31,23 @@ browse_hosts = {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
day_count = 30 |
|
|
|
|
hosts_count = 40 |
|
|
|
|
now_date = datetime.datetime.utcnow() |
|
|
|
|
start_date = now_date - datetime.timedelta(days=day_count) |
|
|
|
|
latest_hosts = { |
|
|
|
|
'queryset': i2phost.objects.filter(activated=True, |
|
|
|
|
date_added__range=(start_date, now_date)).order_by("-date_added")[: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, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
urlpatterns = patterns('', |
|
|
|
|
url(r'^$', direct_to_template, { |
|
|
|
|
'template': 'index.html', |
|
|
|
@ -42,6 +60,7 @@ urlpatterns = patterns('',
@@ -42,6 +60,7 @@ urlpatterns = patterns('',
|
|
|
|
|
}, name='index'), |
|
|
|
|
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'^postkey/', include('pyi2phosts.postkey.urls')), |
|
|
|
|
(r'^jump/', include('pyi2phosts.jump.urls')), |
|
|
|
|
# Example: |
|
|
|
|