Login

Snippets by anilshanbhag

Snippet List

JSON decorator for views handling ajax requests

Sample usage for using decorator `@json_response(ajax_required=True, login_required=True)` `def subscribe(request):` ` return {"status":"success"}` Converts a function returning dict into json response. Does is_ajax check and user authenticated check if set in flags. When function returns HttpResponse does nothing.

  • ajax
  • json
  • decorator
  • jsonp
Read More

anilshanbhag has posted 1 snippet.