@register.filter<EOL>def sliceupto(value, upto):
try:<EOL><INDENT>return value[<NUM_LIT:0>:upto]<EOL><DEDENT>except (ValueError, TypeError):<EOL><INDENT>return value<EOL><DEDENT>
An additional slice feature working with int variables
which can be set within the context of a view.
Usage in template: {% for obj in list|sliceupto:z %}