def edit_form_actions(request, domain, app_id, form_unique_id): app = get_app(domain, app_id) form = app.get_form(form_unique_id) module = form.get_module() old_load_from_form = form.actions.load_from_form form.actions = FormActions.wrap(json.loads(request.POST['actions'])) add_properties_to_data_dictionary(domain, module.case_type, list(form.actions.update_case.update.keys())) if old_load_from_form: form.actions.load_from_form = old_load_from_form for condition in (form.actions.open_case.condition, form.actions.close_case.condition): if isinstance(condition.answer, six.string_types): soft_assert_type_text(condition.answer) condition.answer = condition.answer.strip('"\'') form.requires = request.POST.get('requires', form.requires) if actions_use_usercase(form.actions): if not is_usercase_in_use(domain): enable_usercase(domain) add_properties_to_data_dictionary(domain, USERCASE_TYPE, list(form.actions.usercase_update.update.keys())) response_json = {} app.save(response_json) response_json['propertiesMap'] = get_all_case_properties(app) response_json['usercasePropertiesMap'] = get_usercase_properties(app) return json_response(response_json)
def edit_form_actions(request, domain, app_id, form_unique_id): app = get_app(domain, app_id) form = app.get_form(form_unique_id) module = form.get_module() old_load_from_form = form.actions.load_from_form form.actions = FormActions.wrap(json.loads(request.POST['actions'])) add_properties_to_data_dictionary( domain, module.case_type, list(form.actions.update_case.update.keys())) if old_load_from_form: form.actions.load_from_form = old_load_from_form for condition in (form.actions.open_case.condition, form.actions.close_case.condition): if isinstance(condition.answer, six.string_types): soft_assert_type_text(condition.answer) condition.answer = condition.answer.strip('"\'') form.requires = request.POST.get('requires', form.requires) if actions_use_usercase(form.actions): if not is_usercase_in_use(domain): enable_usercase(domain) add_properties_to_data_dictionary( domain, USERCASE_TYPE, list(form.actions.usercase_update.update.keys())) response_json = {} app.save(response_json) response_json['propertiesMap'] = get_all_case_properties(app) response_json['usercasePropertiesMap'] = get_usercase_properties(app) return json_response(response_json)
def edit_form_actions(request, domain, app_id, module_id, form_id): app = get_app(domain, app_id) form = app.get_module(module_id).get_form(form_id) form.actions = FormActions.wrap(json.loads(request.POST['actions'])) for condition in (form.actions.open_case.condition, form.actions.close_case.condition): if isinstance(condition.answer, basestring): condition.answer = condition.answer.strip('"\'') form.requires = request.POST.get('requires', form.requires) if actions_use_usercase(form.actions) and not is_usercase_in_use(domain): enable_usercase(domain) response_json = {} app.save(response_json) response_json['propertiesMap'] = get_all_case_properties(app) response_json['usercasePropertiesMap'] = get_usercase_properties(app) return json_response(response_json)
def edit_form_actions(request, domain, app_id, module_id, form_id): app = get_app(domain, app_id) form = app.get_module(module_id).get_form(form_id) old_load_from_form = form.actions.load_from_form form.actions = FormActions.wrap(json.loads(request.POST['actions'])) if old_load_from_form: form.actions.load_from_form = old_load_from_form for condition in (form.actions.open_case.condition, form.actions.close_case.condition): if isinstance(condition.answer, basestring): condition.answer = condition.answer.strip('"\'') form.requires = request.POST.get('requires', form.requires) if actions_use_usercase(form.actions) and not is_usercase_in_use(domain): enable_usercase(domain) response_json = {} app.save(response_json) response_json['propertiesMap'] = get_all_case_properties(app) response_json['usercasePropertiesMap'] = get_usercase_properties(app) return json_response(response_json)