django for loop on html cannot retrieve every data fields for its object_lists

Why for my output.htm file, when I use django template “for loop” tags to retrieve data on {{ post.firstname }} and also {{ post.surname }}, it shows no result? Hope for help. Thanks in advance.

Ps: below code is only part of the work. This mean I didn’t write out python libraries, full html for below code.

#views.py

class Student_list(View):
    def get(self, request):
        posts = Student.objects.all().values_list("firstname", "surname").union(Teacher.objects.all().values_list("firstname", "surname"))
        """raw sql => SELECT * FROM l2_OR_queries_student WHERE surname LIKE 'bald%' OR surname LIKE 'aus%' """
        return render(request, "l4_UNION_queries/output.htm", context = {"posts": posts})
<!--output.htm -->

    <table>
        <tr>
            <th>First Name</th>
            <th>Surname</th>
        </tr>

        {% for post in posts %}
        <tr>
            <td>{{ post.firstname }}</td>
            <td>{{ post.surname }}</td>
        </tr>
        {% endfor %}
    </table>
student.sqlite3

id  firstname   surname age classroom   teacher
4   shaina  austin  20  1   trellany
5   raquel  avery-parker    21  2   robin
6   lakisha baldwin 20  3   crystal


teacher.sqlite3
id  firstname   surname
9   trellany    abraham
10  robin   adkins
11  crystal allen
12  shaina  young

Answer

 posts = Student.objects.all().values("firstname", "surname").union(Teacher.objects.all().values("firstname", "surname"))

You need to use values() instead of values_list() because values_list() returns the objects as a list. To access them by keys just use values().