From e919e8f04c83f3b1a141407f27de15f60a3930e5 Mon Sep 17 00:00:00 2001 From: Stanislaw Klekot Date: Tue, 1 Jul 2014 22:40:44 +0200 Subject: [PATCH] Added small self-discovery feature to API. --- wlokalu/api/v1/urls.py | 1 + wlokalu/api/v1/views.py | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/wlokalu/api/v1/urls.py b/wlokalu/api/v1/urls.py index f0bbb64..ac5ff85 100644 --- a/wlokalu/api/v1/urls.py +++ b/wlokalu/api/v1/urls.py @@ -6,6 +6,7 @@ from django.conf import settings #----------------------------------------------------------------------------- urlpatterns = patterns('wlokalu.api.v1.views', + (r'^$', 'list_elements', {'subpages': ['person', 'sensor']}), (r'^person/?$', 'list_presence'), (r'^person/(?P.+)$', 'person'), (r'^sensor/?$', 'list_sensors'), diff --git a/wlokalu/api/v1/views.py b/wlokalu/api/v1/views.py index c4f1551..9b23ddf 100644 --- a/wlokalu/api/v1/views.py +++ b/wlokalu/api/v1/views.py @@ -25,6 +25,13 @@ def return_json(function): #----------------------------------------------------------------------------- +@csrf_exempt +@return_json +def list_elements(request, subpages): + return subpages + +#----------------------------------------------------------------------------- + @csrf_exempt @return_json def person(request, nick):