Django template tags allows passing multiple variables or values to the assignment tags. Most people knows passing one variable, but not many and we see many questions how to pass it. Most are confused because of the colon separated passing of values to filters. Comma separation wont work either. The Django supports it by putting space as the separator.


Assume that I want to combine two arrays, one with keys and one with values to a dictionary and assign to a variable for iteration. I can write the function as

def make_dictionary(keys_list, keys_list):
    return dict(zip(keys_list, values_list))

This could be used in template as

{% make_dictionary my_keys my_values as my_dict %}

Happy coding !