Reputation: 163
For example, I have an paginator object with a lot of attributes, and don't want do write something like {{ paginate(paginator) }}
in templates.
How can a get context automatically in the filter function, like a django register.inclusion_tag(…, takes_context=True)
?
Yes, of course, I can do something like paginate(paginator)
, but it looks weird, imho.
Upvotes: 0
Views: 534
Reputation: 163
Oh, here it is.
@jinja2.contextfunction
def paginate(context):
pass
Upvotes: 1