add an index page listing data sources
This commit is contained in:
parent
412dfd6ade
commit
af3671d46e
|
@ -0,0 +1,18 @@
|
|||
{% extends "passerelle/base.html" %}
|
||||
{% load i18n %}
|
||||
{% load url from future %}
|
||||
|
||||
{% block appbar %}
|
||||
<h2>{% trans 'Data Sources' %}</h2>
|
||||
{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<dl>
|
||||
{% for ds in datasources %}
|
||||
<dt><a href="{{ ds.slug }}/">{{ ds.title }}</a></dt>
|
||||
<dd>{{ ds.description }}</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
|
||||
{% endblock %}
|
|
@ -1,6 +1,7 @@
|
|||
from django.conf.urls import patterns, url, include
|
||||
|
||||
urlpatterns = patterns('passerelle.datasources.views',
|
||||
url(r'^$', 'index'),
|
||||
url(r'(?P<datasource>[\w-]+)/$', 'view'),
|
||||
url(r'(?P<datasource>[\w-]+)/json$', 'json'),
|
||||
url(r'(?P<datasource>[\w-]+)/jsonp$', 'jsonp'),
|
||||
|
|
|
@ -4,6 +4,17 @@ from jsonresponse import to_json
|
|||
|
||||
from models import BaseDataSource
|
||||
|
||||
class Index(TemplateView):
|
||||
template_name = 'datasources/index.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(Index, self).get_context_data(**kwargs)
|
||||
context['datasources'] = BaseDataSource.objects.all().order_by('title')
|
||||
return context
|
||||
|
||||
index = Index.as_view()
|
||||
|
||||
|
||||
class View(TemplateView):
|
||||
template_name = 'datasources/view.html'
|
||||
|
||||
|
|
|
@ -22,4 +22,8 @@ Passerelle provides an uniform access to multiple data sources and services.
|
|||
{% endblocktrans %}
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<a href="data/">{% trans 'Data Sources' %}</a>
|
||||
</p>
|
||||
|
||||
{% endblock %}
|
||||
|
|
Loading…
Reference in New Issue