1👍
Your filter definition is fine. The problem is with the missing colons and indentation:
@register.filter
def roundnumber(value):
if value > 1.75 and value < 2.25: # colon
return 2 # indentation
# ...
👤nima
Source:stackexchange.com