Commit 3c015e67 authored by Franziska Koehn's avatar Franziska Koehn
Browse files

function get_field_key_by_label added

parent 7183ea83
......@@ -129,6 +129,20 @@ def get_field_label_by_key(root_type, field_key):
return field_key
def get_field_key_by_label(root_type, label):
"""Returns the key of the given field-label.
:root_type: str, Root-Type of label
:label: str, field-label, for which the key will be returned
fields = get_fields(root_type)
for f in fields:
if f['label'] == label:
return f["key"]
return label
def get_field_label_by_field(root_type, field):
Returns the label of the given field.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment