Skip to content

Commit

Permalink
WIP on #337.
Browse files Browse the repository at this point in the history
  • Loading branch information
mjordan committed Jul 2, 2024
1 parent ecd5d86 commit 7d3fa9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions WorkbenchConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def get_default_config(self):
"paged_content_from_directories": False,
"delete_media_with_nodes": True,
"allow_adding_terms": False,
"columns_with_term_names": [],
"nodes_only": False,
"log_response_time": False,
"adaptive_pause_threshold": 2,
Expand Down
12 changes: 9 additions & 3 deletions workbench_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6542,7 +6542,7 @@ def prepare_term_id(config, vocab_ids, field_name, term):
"""
term = str(term)
term = term.strip()
if value_is_numeric(term):
if value_is_numeric(term) and field_name not in config["columns_with_term_names"]:
return term
entity_reference_view_endpoints = get_entity_reference_view_endpoints(config)
if not entity_reference_view_endpoints and vocab_ids is False:
Expand Down Expand Up @@ -8043,7 +8043,10 @@ def validate_taxonomy_reference_value(
)

# Check to see if field_value is a member of the field's vocabularies. First, check whether field_value is a term ID.
if value_is_numeric(field_value):
if (
value_is_numeric(field_value)
and csv_field_name not in config["columns_with_term_names"]
):
field_value = field_value.strip()
term_in_vocabs = False
for vocab_id in this_fields_vocabularies:
Expand Down Expand Up @@ -8125,7 +8128,10 @@ def validate_taxonomy_reference_value(
new_terms_to_add = []
for vocabulary in this_fields_vocabularies:
tid = find_term_in_vocab(config, vocabulary, field_value)
if value_is_numeric(tid) is False:
if (
value_is_numeric(tid) is False
or csv_field_name in config["columns_with_term_names"]
):
# Single taxonomy fields.
if len(this_fields_vocabularies) == 1:
if config["allow_adding_terms"] is True:
Expand Down

0 comments on commit 7d3fa9f

Please sign in to comment.