1
0
mirror of https://github.com/r4sas/py-i2phosts synced 2025-01-09 22:38:08 +00:00
py-i2phosts/pyi2phosts/urls.py

67 lines
2.1 KiB
Python
Raw Normal View History

2010-10-06 19:02:08 +00:00
from django.conf.urls.defaults import *
from django.views.generic.simple import direct_to_template
from django.views.generic.list_detail import object_list
2010-10-06 19:02:08 +00:00
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
from pyi2phosts.lib.rss import AliveHostsFeed
from pyi2phosts.lib.utils import get_b32
from pyi2phosts.extsources.models import ExternalSource
2010-11-06 19:11:08 +00:00
from pyi2phosts.postkey.models import i2phost
import settings
extsources = {
'queryset': ExternalSource.objects.filter(active=True),
'template_name': 'faq.html',
'template_object_name': 'sources',
'extra_context': {
'title': settings.SITE_NAME,
}
}
2010-11-06 19:11:08 +00:00
browse_hosts = {
'queryset': i2phost.objects.filter(activated=True).order_by("-last_seen"),
2010-11-06 19:11:08 +00:00
'template_name': 'browse.html',
'template_object_name': 'host',
2010-11-06 21:14:39 +00:00
'paginate_by': 40,
'extra_context': {
'title': settings.SITE_NAME,
}
2010-11-06 19:11:08 +00:00
}
2010-10-06 19:02:08 +00:00
urlpatterns = patterns('',
url(r'^$', direct_to_template, {
'template': 'index.html',
'extra_context': {
'title': settings.SITE_NAME,
'domain': settings.DOMAIN,
'b64': settings.MY_B64,
'b32': get_b32(settings.MY_B64)
}
}, name='index'),
url(r'^faq/$', object_list, extsources, name='faq'),
2010-11-06 19:11:08 +00:00
url(r'^browse/$', object_list, browse_hosts, name='browse'),
2011-02-17 17:29:52 +00:00
url(r'^browse/rss/$', AliveHostsFeed(), name='browse-rss'),
(r'^latest/', include('pyi2phosts.latest.urls')),
2010-11-12 19:53:31 +00:00
(r'^search/$', include('pyi2phosts.search.urls')),
(r'^postkey/', include('pyi2phosts.postkey.urls')),
(r'^jump/', include('pyi2phosts.jump.urls')),
2011-02-18 19:44:56 +00:00
(r'^i18n/', include('django.conf.urls.i18n')),
# Example:
# (r'^pyi2phosts.', include('pyi2phosts.foo.urls')),
2010-10-06 19:02:08 +00:00
# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the next line to enable the admin:
(r'^admin/', include(admin.site.urls)),
)
if settings.DEBUG:
urlpatterns += patterns('', (r'static/(?P<path>.*)$', 'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT, 'show_indexes':True}))