Q:

Did you forget to register or load this tag in Django?

In the django project I am working on, when I add this line {% set alpha = SafeExec.objects.get(testcase=a_test) %} to my html, it is showing this error. How to get rid of it?
This is my template code:
{% for a_testcases in testcases %}
    <li><i>{{ a_testcases.0.program.name }}</i> <br/>
    {% for a_test in a_testcases %}
        {% set alpha = SafeExec.objects.get(testcase=a_test) %}
            {{ alpha.cpu_time }}
    {% endfor %}
    <input id="id{{ a_test.id }}" type="checkbox" name="testcases_cbx" value="{{ a_test.id }}" checked/>
    <label style="display: inline" for="id{{ a_test.id }}">{{ a_test.name }}</label> <br/>
{% endfor %}

This is screenshot of error:

A:

You can't do any of this in the template. set isn't a template tag; SafeExec won't exist in the context; and you can't call methods with arguments in templates anyway.
Without seeing your models I can't tell exactly what you need to do, but it looks like the testcase has a foreign key to SafeExec, so you should just do:
{{ a_test.safeexec.cpu_time }}

