As per django
https://docs.djangoproject.com/en/1.10/ref/templates/api/#variables-and-lookups
Variables and lookups
Variable names must consist of any letter (A-Z), any digit (0-9), an underscore (but they must not start with an underscore) or a dot.
Dots have a special meaning in template rendering. A dot in a variable name signifies a lookup. Specifically, when the template system encounters a dot in a variable name, it tries the following lookups, in this order:
Dictionary lookup. Example: foo["bar"]
Attribute lookup. Example: foo.bar
List-index lookup. Example: foo[bar]
Note that “bar” in a template expression like {{ foo.bar }} will be interpreted as a literal string and not using the value of the variable “bar”, if one exists in the template context.
So you can use custom filter for this purpose.
You can make custom template filter:
#here, import DAYS
@register.filter
def return_day(i):
try:
return DAYS[i][1]
except:
return N.A
And in template
{{ class_weekday.key_value|return_day }}