Skip to content
Browse files

Merge branch 'master' of https://github.com/rsaikali/django-skwissh

  • Loading branch information...
2 parents 6ea61ef + b60b61e commit 3f79866af8ea88a6314f5421c6e9149e4168d684 @mbi mbi committed
Showing with 12 additions and 0 deletions.
  1. +3 −0 skwissh/urls.py
  2. +9 −0 skwissh/views.py
View
3 skwissh/urls.py
@@ -64,6 +64,9 @@ def get_groups():
# Ajax
url(r'^mesures/(\d+)/(\d+)/(\w+)/$', 'skwissh.views.mesures', name='mesures'),
+
+ # Ajax for Android
+ url(r'^servers/$', 'skwissh.views.servers', name='servers'),
)
if settings.DEBUG:
View
9 skwissh/views.py
@@ -79,3 +79,12 @@ def mesures(request, server_id, probe_id, period):
return HttpResponse(serializers.serialize('json', data), 'application/javascript')
else:
return HttpResponseServerError()
+
+
+@login_required
+def servers(request):
+ return HttpResponse(serializers.serialize('json', Server.objects.all().select_related()), 'application/javascript')
+ if request.is_ajax():
+ return HttpResponse(serializers.serialize('json', Server.objects.all()), 'application/javascript')
+ else:
+ return HttpResponseServerError()

0 comments on commit 3f79866

Please sign in to comment.
Something went wrong with that request. Please try again.