def put_routing_rule_active_status(request, id, json): data = json # the confirm name is the name of the form data["status"] = data["form_name"] data = client.put(request, f"/routing-rules/{id}/status/", data) return data.json(), data.status_code
def put_organisation(request, pk, json): if "status" in json: del json["status"] json = nest_data(json) data = client.put(request, f"/organisations/{pk}/", json) return data.json(), data.status_code
def put_queue_case_assignments(request, pk, _): case_ids = request.GET.getlist("cases") json = {"case_assignments": [], "remove_existing_assignments": True, "note": request.POST.get("note")} for case_id in case_ids: json["case_assignments"].append({"case_id": case_id, "users": request.POST.getlist("users")}) response = client.put(request, f"/queues/{pk}/case-assignments/", json) return response.json(), response.status_code
def put_goods_query_clc(request, pk, json): # This is a workaround due to RespondCLCQuery not using a SingleFormView if "control_list_entries[]" in json: json["control_list_entries"] = json.getlist("control_list_entries[]") response = client.put(request, f"/queries/goods-queries/{pk}/clc-response/", json) return response.json(), response.status_code
def set_picklist_item_status(request, pk, json): if "status" not in json: return { "errors": { "response": [Picklists.SELECT_OPTION] } }, HTTPStatus.BAD_REQUEST response = client.put(request, f"/picklist/{pk}", json) return response.json(), response.status_code
def put_queue_single_case_assignment(request, pk, json): queue = json.get("queue") if queue: json = { "case_assignments": [{"case_id": json.get("case_pk"), "users": [json.get("user_pk")]}], "note": json.get("note"), } data = client.put(request, f"/queues/{queue}/case-assignments/", json) return data.json(), data.status_code else: return {"errors": {"queue": [AssignUserPage.QUEUE_ERROR_MESSAGE]}}, HTTPStatus.BAD_REQUEST
def put_role(request, pk, json): organisation_id = request.session["organisation"] data = client.put(request, f"/organisations/{organisation_id}/roles/{pk}/", json) return data.json(), data.status_code
def put_ecju_query(request, pk, query_pk, json): data = client.put(request, f"/cases/{pk}/ecju-queries/{query_pk}/", json) return data.json(), data.status_code
def put_picklist_item(request, pk, json): data = client.put(request, f"/picklist/{pk}", json) return data.json(), data.status_code
def update_user(request, pk, json): data = client.put(request, f"/users/{pk}/", json) return data.json(), data.status_code
def set_application_status(request, pk, status): json = {"status": status} data = client.put(request, f"/applications/{pk}/status/", json) return data.json(), data.status_code
def put_team(request, pk, json): data = client.put(request, f"/teams/{pk}/", json) return data.json(), data.status_code
def edit_good_details(request, pk, json): data = client.put(request, f"/goods/{pk}/details/", json) return data.json(), data.status_code
def put_application_with_clearance_types(request, pk, json): # Inject the clearance types as an empty set into JSON if they are not present json["types"] = json.get("types", []) data = client.put(request, f"/applications/{pk}", json) return data.json(), data.status_code
def submit_application(request, pk, json=None): json = json or {} data = client.put(request, f"/applications/{pk}/submit/", data=json) return data.json(), data.status_code
def put_end_use_details(request, pk, json): data = client.put(request, f"/applications/{pk}/end-use-details/", json) return data.json(), data.status_code
def put_temporary_export_details(request, pk, json): if "year" in json and "month" in json and "day" in json: json["proposed_return_date"] = create_formatted_date_from_components(json) data = client.put(request, f"/applications/{pk}/temporary-export-details/", json) return data.json(), data.status_code
def put_application_route_of_goods(request, pk, json): data = client.put(request, f"/applications/{pk}/route-of-goods/", json) return data.json(), data.status_code
def put_application(request, pk, json): data = client.put(request, f"/applications/{pk}", json) return data.json(), data.status_code
def put_goods_type_countries(request, app_pk, json): data = client.put(request, f"/applications/{app_pk}/goodstype/assign-countries/", json) return data.json(), data.status_code
def put_routing_rule(request, id, json): data = _remove_none_from_post_data_additional_rules_list(json) data = convert_flags_to_list(data) response = client.put(request, f"/routing-rules/{id}", data) return response.json(), response.status_code
def put_goods_query_pv_grading(request, pk, json): response = client.put(request, f"/queries/goods-queries/{pk}/pv-grading-response/", json) return response.json(), response.status_code
def put_flagging_rule(request, pk, json): data = json if json.get("form_name"): data["status"] = json.get("form_name") data = client.put(request, f"/flags/rules/{pk}", json) return data.json(), data.status_code
def put_role(request, pk, json): data = client.put(request, f"/gov-users/roles/{pk}/", json) return data.json(), data.status_code
def put_letter_template(request, pk, json): data = client.put(request, f"/letter-templates/{pk}/", json) return data.json(), data.status_code
def put_organisation_user(request, user_pk, json): organisation_id = str(request.session["organisation"]) data = client.put(request, f"/organisations/{organisation_id}/users/{user_pk}/", json) return data.json(), data.status_code
def put_queue(request, pk, json): data = client.put(request, f"/queues/{pk}/", json) return data.json(), data.status_code
def put_assign_sites(request, pk, json): data = client.put(request, f"/users/{pk}/sites/", json) return data.json(), data.status_code
def put_organisation_status(request, pk, json): data = client.put(request, f"/organisations/{pk}/status/", json) return data.json(), data.status_code
def put_contract_type_for_country(request, pk, json): data = client.put(request, f"/applications/{pk}/contract-types/", json) return data.json(), data.status_code