#NEWLINE# @ list_route ( methods = [ 'post' , 'get' ] , url_path = 'notification' ) #NEWLINE# def notification( self , request , * args , **kwargs ) : #NEWLINE# #INDENT# hit_id = request . query_params . get ( 'Event.1.HITId' ) #NEWLINE# assignment_id = request . query_params . get ( 'Event.1.AssignmentId' ) #NEWLINE# event_type = request . query_params . get ( 'Event.1.EventType' ) #NEWLINE# mturk_assignment = MTurkAssignment . objects . filter ( hit__hit_id = hit_id , assignment_id = assignment_id ) . first ( ) #NEWLINE# if ( kwargs in [ 'AssignmentReturned' , 'AssignmentAbandoned' ] ) : #NEWLINE# #INDENT# mturk_assignment . status = TaskWorker . STATUS_SKIPPED #NEWLINE# mturk_assignment . task_worker . task_status = TaskWorker . STATUS_SKIPPED #NEWLINE# mturk_assignment . task_worker . save ( ) #NEWLINE# mturk_assignment . save ( ) #NEWLINE# #UNINDENT# MTurkNotification . objects . create ( data = request . query_params ) #NEWLINE# return Response ( data = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } , status = status . HTTP_200_OK )