@require_POST
@csrf_exempt
def unhelpful_survey(request):
 vote = get_object_or_404(HelpfulVote, id=smart_int(request.POST.get('vote_id')))
 if ((not vote.helpful) and (not vote.metadata.filter(key='survey').exists())):
  survey = request.POST.copy()
  survey.pop('vote_id')
  survey.pop('button')
  vote.add_metadata('survey', truncated_json_dumps(survey, 1000, 'comment'))
 return HttpResponse(json.dumps({'message': _('Thanks for making us better!')}))

@ require_POST @ csrf_exempt def unhelpful_survey ( request ) : vote = get_object_or_404 ( HelpfulVote , id = smart_int ( request . POST . get ( 'vote_id' ) ) ) if ( ( not vote . helpful ) and ( not vote . metadata . filter ( key = 'survey' ) . exists ( ) ) ) : survey = request . POST . copy ( ) survey . pop ( 'vote_id' ) survey . pop ( 'button' ) vote . add_metadata ( 'survey' , truncated_json_dumps ( survey , 1000 , 'comment' ) ) return HttpResponse ( json . dumps ( { 'message' : _ ( 'Thanks for making us better!' ) } ) )
ajax only view: unhelpful vote survey processing .