Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from django import template
- register = template.Library()
- @register.filter(name='inc')
- def inc(value,na):
- valuee = value
- if '=' in value:
- valuee = value.split('=')[1]
- vvalue = valuee+ int(na)
- return vvalue
- register.filter('inc', inc)
- @register.simple_tag(name='division')
- def division(*args):
- try:
- f_p,s_p,typ = args
- except ValueError:
- f_p, s_p = args
- res = float(int(f_p) /int(s_p))
- return res
- else:
- typp,no = typ.split('=')
- if no == 'True':
- res = int(int(f_p)/int(s_p))
- return res
- else:
- res = float(int(f_p)/int(s_p))
- return res
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement