aboutsummaryrefslogtreecommitdiffstats
path: root/youtube/__init__.py
diff options
context:
space:
mode:
Diffstat (limited to 'youtube/__init__.py')
-rw-r--r--youtube/__init__.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/youtube/__init__.py b/youtube/__init__.py
index 0137e86..534b9f8 100644
--- a/youtube/__init__.py
+++ b/youtube/__init__.py
@@ -23,3 +23,10 @@ def inject_theme_preference():
'theme_path': '/youtube.com/static/' + theme_names[settings.theme] + '.css',
}
+@yt_app.template_filter('commatize')
+def commatize(num):
+ if num is None:
+ return ''
+ if isinstance(num, str):
+ num = int(num)
+ return '{:,}'.format(num)