I have an errror: 'run_target' is not a valid tag library: Template library run_target not found, tried django.templatetags.run_target
I don't know why it can't work, even i add 'db.templatefilters' it can't work too... Can anyone help me? thank you :)
Below is my file structure:
db/
models.py
templatefilters/
__init__.py
run_target.py
templates/
run.html
run_target.py
from django import template
register = template.Library()
@register.simple_tag
def dictKeyLookup(the_dict, key):
return the_dict[key]
run.html
{% extends "index.html" %}
**{% load run_target %}**
{% block content %}
<div style="margin-left:150px; margin-top:10px">
<a href="/home">Home</a> >> <b>run</b>
</div>
<form name="form" method="post">
<br>
<input type="submit" value="Delete" style="margin-left:149px; width:80px; height:30px">
<table border="1"; style="margin-left:150px; border-collapse:collapse;margin-top:10px"; cellpadding="4" borderColor=black>
{% for run in run_list %}
<tr>
<td>{% dictKeyLookup target_dict run.id %}</td>
</tr>
{% endfor %}
</table>
</form>
{% endblock %}