Skip to content

Instantly share code, notes, and snippets.

View ImOmkar's full-sized avatar
:octocat:
Committing

Omkar Parab ImOmkar

:octocat:
Committing
View GitHub Profile
from django import template
register = template.Library()
@register.filter
def cool_number(value, num_decimals=2):
"""
Django template filter to convert regular numbers to a
cool format (ie: 2K, 434.4K, 33M...)