Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added json Export at /json

  • Loading branch information...
commit c68eccb7582ba9bdcab8e27661f35cbcda9dd1c1 1 parent fe8a88d
@plaetzchen authored
Showing with 8 additions and 0 deletions.
  1. +1 −0  lauschigeplaetzchen/urls.py
  2. +7 −0 places/views.py
View
1  lauschigeplaetzchen/urls.py
@@ -25,6 +25,7 @@
(r'^submit/', 'places.views.submit'),
(r'^about/', 'places.views.about'),
(r"^orte/add_comment/(?P<slug>[-\w]+)/$", "places.views.add_comment"),
+ (r'^json/', 'places.views.json'),
)
if settings.DEBUG:
View
7 places/views.py
@@ -14,6 +14,8 @@
from os.path import join as pjoin
import string, random, os
+from django.core import serializers
+
# import the logging library
import logging
@@ -90,3 +92,8 @@ def submit(request):
def about(request):
return render_to_response('places/about.html',
context_instance=RequestContext(request))
+
+def json(request):
+ all_objects = list(Place.objects.all()) + list(Comment.objects.all())
+ data = serializers.serialize('json', all_objects)
+ return HttpResponse(data, content_type = 'application/javascript; charset=utf8')
Please sign in to comment.
Something went wrong with that request. Please try again.