@require_POST
def ajax_enable(request):
 if (not request.user.is_authenticated()):
  raise PermissionDenied
 enable_notifications(request.user)
 return HttpResponse(status=204)

@ require_POST def ajax_enable ( request ) : if ( not request . user . is_authenticated ( ) ) : raise PermissionDenied enable_notifications ( request . user ) return HttpResponse ( status = 204 )
a view that enables notifications for the authenticated user this view should be invoked by an ajax post call .