Just  a quick tip: Sometimes you need a little JSON endpoint for some 
feature of your site or project, and a full REST framework like DRF is 
completely overkill. Django makes this incredibly easy, out of the box:


from django.http import JsonResponse

def some_view(request):
    my_dict = {'foo': "bar"}  # Arbitrarily complex dictionary
    return JsonResponse(my_dict) 


And that's it - the URL for that view now emits JSON, ready for JS to 
consume. It's ridiculous how little code you need to make it happen.

./s


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/eec3ec6d-921e-46b7-9099-d3dcc08bc08c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to