2👍
✅
Just implement a simple type/value check for num1
and num2
:
@register.simple_tag()
def average(num1, num2):
if num1 and num2 and num1 != 0 and num2 != 0:
return round(float(num1 / num2), 2)
return 'Your error message'
- [Answered ]-Request.POST used by ModelForm with prefix not working with client.post in unit test
- [Answered ]-Type error with function on queryset
Source:stackexchange.com