[Solved]-Django template, send two arguments to template tag?


From my point of view it looks easier to use a simple tag instead of a template filter so you can call it without needing to send a string.


Your template would be just:

{% load remaining_cost %}
{# Don't forget to load the template tag as above #}

<th>{% remaining_cost item.cost_per_month item.install_date item.comtract_length %}</th>

and the template tag would be:

def remaining_cost(cost_per_month, install_date, contract_length):
    cost = contract_remainder(install_date, contract_length) * cost_per_month
    return cost 

Leave a comment