[Answer]-Why is this template filter invalid?

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

Leave a comment