Template Tags

Simple Tags

tom_common.templatetags.tom_common_extras.comments_enabled()

Returns the TOM setting specifying whether or not comments are enabled

tom_common.templatetags.tom_common_extras.verbose_name(instance, field_name)

Displays the more descriptive field name from a Django model field

Inclusion Tags

tom_common.templatetags.tom_common_extras.recent_comments(context, limit=10)

Displays a list of the most recent comments in the TOM up to the given limit, or 10 if not specified.

Comments will only be displayed for targets which the logged-in user has permission to view.

Filters

tom_common.templatetags.tom_common_extras.truncate_value_for_display(value, width=12)

Limits the length and format of displayed values to width:

Call using {% value|truncate_value_for_display:width %}

  • anything with characters less than or equal to the given width is displayed as-is

  • numbers longer than the width are truncated to that width digits if the number is between 10^-3 and 10^width

  • numbers outside that range are converted to scientific notation

  • Words larger than 50% over width characters are split and display is limited to 5 lines of text