Skip to content

Commit

Permalink
Links to codelists - rewrite to OCDS Standard - check URL first
Browse files Browse the repository at this point in the history
  • Loading branch information
odscjames committed Dec 5, 2023
1 parent 9eaf967 commit d71c81e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions cove_ocds/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,10 +244,11 @@ def explore_ocds(request, pk):

for key in ("additional_closed_codelist_values", "additional_open_codelist_values"):
for path_string, codelist_info in context[key].items():
codelist_info["codelist_url"] = (
"https://standard.open-contracting.org/{}/en/schema/codelists/#".format(db_data.data_schema_version)
+ re.sub(r"([A-Z])", r"-\1", codelist_info["codelist"].split(".")[0]).lower()
)
if codelist_info["codelist_url"].startswith(schema_ocds.codelists):
codelist_info["codelist_url"] = (
"https://standard.open-contracting.org/{}/en/schema/codelists/#".format(db_data.data_schema_version)
+ re.sub(r"([A-Z])", r"-\1", codelist_info["codelist"].split(".")[0]).lower()
)

schema_version = getattr(schema_ocds, "version", None)
if schema_version:
Expand Down

0 comments on commit d71c81e

Please sign in to comment.