#NEWLINE# @ require_deploy_apps #NEWLINE# def task_creation( request , domain , app_id , module_id , form_id ) : #NEWLINE# #INDENT# '\n    This view is meant to be a run as a one-off script to support a specific\n    app that Jeremy is writing. Running this script subsequent times on the\n    same form will not have adverse affects.\n    :param request:\n    :param domain:\n    :param app_id:\n    :param module_id:\n    :param form_id:\n    :return:\n    ' #NEWLINE# if ( request . method == 'POST' ) : #NEWLINE# #INDENT# html_form = TaskCreationForm ( request . POST ) #NEWLINE# if html_form . is_valid ( ) : #NEWLINE# #INDENT# questions = html_form . cleaned_data [ 'question_ids' ] . split ( ) #NEWLINE# form = get_app ( domain , app_id ) . modules [ int ( module_id ) ] . forms [ int ( form_id ) ] #NEWLINE# message = _ucla_form_modifier ( form , questions ) #NEWLINE# return HttpResponse ( module_id , content_type = 'text/plain' ) #NEWLINE# #UNINDENT# return HttpResponse ( 'Soemthing was wrong with the form you submitted. Your CommCare form is unchanged.' , content_type = 'text/plain' ) #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# if ( request . method == 'GET' ) : #NEWLINE# #INDENT# html_form = TaskCreationForm ( ) #NEWLINE# response = HttpResponse ( ) #NEWLINE# response . write ( ( ( '<form action="' + reverse ( 'ucla_task_creation' , args = ( domain , app_id , module_id , form_id ) ) ) + '" method="post">' ) ) #NEWLINE# response . write ( html_form . as_p ( ) ) #NEWLINE# response . write ( '<p><input type="submit" value="Process Form"></p>' ) #NEWLINE# response . write ( '</form>' ) #NEWLINE# return response #NEWLINE# #UNINDENT# else : #NEWLINE# #INDENT# return HttpResponse ( 'GET or POST only.' , content_type = 'text/plain' )