Reputation: 65
Is there a way to use a dictionary as named arguments in a template tag in Django?
Assuming I have a dictionary like :
my_dict = {
'param1': 'value1',
'param2': 'value2'
}
I know that can do for example :
a_function(**my_dict)
But can I do something like :
{% url 'my_app.viewname' **my_dict %}
The url tag is actually what I'm trying to use here, maybe is there an other way to achieve this?
Upvotes: 1
Views: 375
Reputation: 77902
Django template language is not Python, so no, there's no argument unpacking etc. You can eventually write you own custom url
tag taking a dict as argument, but that's about it.
Upvotes: 1