Skip to content Skip to sidebar Skip to footer

Jinja2 Url Generation

{{ object.name }} Cause an error: reverse() got an unexpected keyword argument 'affiliate'

Solution 1:

As your url() function seem to be an alias to the Django's reverse(), the function signature is different from the regular template tag. So just use the reverse() syntax:

<a href="{{ url('affiliate', args=[object.slug]) }}">{{ object.name }}</a>

Post a Comment for "Jinja2 Url Generation"