I know that Django template allow this structure
{% for i in paginator.page_range|slice:":10" %}
It means just 10 element from paginator.page_range list.
But how can instead passing 10, want to passing a variable, like this:
{% for i in paginator.page_range|slice:":page_obj.number" %}
You can use slice:":{{page_obj.number}}", the {{}} is the method to call a variable inside django template.