Anybody knows if there is any package related to templating json like Rails JBuilder or RABL gems ?
I have this code and want to separate out json rendering code and business logic code.
from django.http import HttpResponse
import json
# Create your views here.
def index(request):
# Business logic
# hidden ----------
# rendering logic
data = {'foo': 'bar'}
another = {'something': 'hello'}
return HttpResponse(json.dumps({'data':data,'another':another}), content_type='application/json')
Tastypie is a webservice API framework for Django. It provides a convenient, yet powerful and highly customizable, abstraction for creating REST-style interfaces.
Django REST framework is a powerful and flexible toolkit that makes it easy to build Web APIs.