Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@javrasya
Created February 19, 2015 12:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save javrasya/56ed261cad0a9e1c405b to your computer and use it in GitHub Desktop.
Save javrasya/56ed261cad0a9e1c405b to your computer and use it in GitHub Desktop.
__author__ = 'ahmetdal'
__author__ = 'ahmetdal'
from django import template
register = template.Library()
@register.filter('divide')
def divide(value, by):
return int(value) / by if value else None
import datetime
__author__ = 'ahmetdal'
from django import template
register = template.Library()
@register.filter('timestamp_to_time')
def convert_timestamp_to_time(timestamp):
return datetime.datetime.fromtimestamp(int(timestamp)) if timestamp else None
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment