Browse Source

webinterface: add hosts browsing page

pull/1/head
Hidden Z 14 years ago
parent
commit
e3025b02e9
  1. 1
      pyi2phosts/templates/base.html
  2. 11
      pyi2phosts/templates/browse.html
  3. 8
      pyi2phosts/urls.py

1
pyi2phosts/templates/base.html

@ -15,6 +15,7 @@
<ul> <ul>
<li><a href=/>Home</a></li> <li><a href=/>Home</a></li>
<li><a href={% url faq %}>FAQ</a></li> <li><a href={% url faq %}>FAQ</a></li>
<li><a href={% url browse %}>Browse alive hosts</a></li>
<li><a href={% url pyi2phosts.postkey.views.addkey %}>Register a domain</a></li> <li><a href={% url pyi2phosts.postkey.views.addkey %}>Register a domain</a></li>
</ul> </ul>
</div> </div>

11
pyi2phosts/templates/browse.html

@ -0,0 +1,11 @@
{% extends "base.html" %}
{% block content %}
<table>
<tr><td>Host</td><td>Last seen</td><td>Description</td>
{% for host in host_list %}
<tr><td>{{ host.name }}</td><td>{{ host.last_seen }}</td><td>
{{ host.description }}</td></tr>
{% endfor %}
</table>
{% endblock %}

8
pyi2phosts/urls.py

@ -8,6 +8,7 @@ admin.autodiscover()
from pyi2phosts.lib.utils import get_b32 from pyi2phosts.lib.utils import get_b32
from pyi2phosts.extsources.models import ExternalSource from pyi2phosts.extsources.models import ExternalSource
from pyi2phosts.postkey.models import i2phost
import settings import settings
extsources = { extsources = {
@ -19,6 +20,12 @@ extsources = {
} }
} }
browse_hosts = {
'queryset': i2phost.objects.filter(activated=True),
'template_name': 'browse.html',
'template_object_name': 'host',
}
urlpatterns = patterns('', urlpatterns = patterns('',
url(r'^$', direct_to_template, { url(r'^$', direct_to_template, {
'template': 'index.html', 'template': 'index.html',
@ -30,6 +37,7 @@ urlpatterns = patterns('',
} }
}, name='index'), }, name='index'),
url(r'^faq/$', object_list, extsources, name='faq'), url(r'^faq/$', object_list, extsources, name='faq'),
url(r'^browse/$', object_list, browse_hosts, name='browse'),
(r'^postkey/', include('pyi2phosts.postkey.urls')), (r'^postkey/', include('pyi2phosts.postkey.urls')),
(r'^jump/', include('pyi2phosts.jump.urls')), (r'^jump/', include('pyi2phosts.jump.urls')),
# Example: # Example:

Loading…
Cancel
Save