I have a function that returns a non-current user's first and last name as a tuple, using the following custom tag, where foo is a username from active directory:
{% name foo %}
I would like to access the first element of the tuple, and the only syntax I could think of is:
{{ {% name foo %}.0 }}
which is incorrect. How can I accomplish this?
You can't do that. If your tag is simply returning a value, there's no way to get the first part of it.
Instead, write an assignment tag, which sets a variable in the context. Then you can do this:
{% name foo as bar %}
{{ bar.0 }}