I added my simple tags to my file in template tags. My first tag is visible and it works properly, but the second one does not work. I receive information ''deposit_earn' is not a registered tag library. Must be one of:'
after I added tags to my template {% load deposit_earn %}
.
My tag file looks like this:
@register.simple_tag()
def multiply(number_instalment_loans, rrso, balance):
rrso_percent = rrso/100
return round(discounted_interest_rate(12, number_instalment_loans, rrso_percent, balance))
@register.simple_tag()
def deposit_earn(period, interest, balance):
interest_percent = interest/100
equals = balance * interest_percent * period / 12
return round(equals)
Why is my first tag working and not the second one? I tried to reset the server after registering the tags, but it did not help.
https://docs.djangoproject.com/en/2.2/howto/custom-template-tags/
you should import templatetags file name, not method name
polls/
__init__.py
models.py
templatetags/
__init__.py
poll_extras.py
views.py
let say multiply and deposit_earn inside of poll_extras.py
then in your template, you just need call poll_extras
{% load poll_extras %}
{{ something|multiply }}
or
{{ something|deposit_earn }}