Skip to content

Commit

Permalink
Only link the identifier in the tables.
Browse files Browse the repository at this point in the history
  • Loading branch information
sfisher committed Dec 17, 2024
1 parent b30aec9 commit 5b37253
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions ui_tags/templatetags/manage_form_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -183,23 +183,27 @@ def data_row(


FUNCTIONS_FOR_FORMATTING = {
'datetime': lambda x, tp, href: datetime_disp(x, href),
'datetime': lambda x, tp: datetime_disp(x),
'identifier': lambda x, tp, href: identifier_disp(x, tp),
'string': lambda x, tp, href: string_value(x, href),
'string': lambda x, tp: string_value(x),
}


def formatted_field(record, field_name, field_display_types, testPrefixes, href):
value = record[field_name]
formatting = field_display_types[field_name]
return FUNCTIONS_FOR_FORMATTING[formatting](value, testPrefixes, href)
# only the identifier gets linked now
if formatting == 'identifier':
return FUNCTIONS_FOR_FORMATTING[formatting](value, testPrefixes, href)
else:
return FUNCTIONS_FOR_FORMATTING[formatting](value, testPrefixes)


def string_value(x, href):
def string_value(x):
if x is None or x.strip() == '':
return ' '
else:
return href + django.utils.html.escape(x) + "</a>"
return django.utils.html.escape(x)


@register.simple_tag
Expand All @@ -222,15 +226,14 @@ def identifier_disp(x, testPrefixes):
)


def datetime_disp(x, href):
def datetime_disp(x):
return (
href
+ django.utils.html.escape(
django.utils.html.escape(
datetime.datetime.utcfromtimestamp(x).strftime(
django.conf.settings.TIME_FORMAT_UI_METADATA
)
)
+ " UTC</a>"
+ " UTC"
)


Expand Down

0 comments on commit 5b37253

Please sign in to comment.