@require_POST
def ajax_disable(request):
 if (not request.user.is_authenticated()):
  raise PermissionDenied
 delete_user_preference(request.user, NOTIFICATION_PREF_KEY)
 return HttpResponse(status=204)

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