How can I output a list in html django?

I have a chat and I need to display a list of people with whom I had correspondence on an html page, i.e. either I wrote to a person or he wrote to me. I wrote the code in , but I don't know how to display an html page.

def send_chat(request):
    resp = {}
    User = get_user_model()
    if request.method == 'POST':
        post =request.POST
        u_from = UserModel.objects.get(id=post['user_from'])
        u_to = UserModel.objects.get(id=post['user_to'])
        messages = request.user.received.all()
        pk_list = messages.values_list('user_from__pk',flat=True).distinct()
        correspondents = get_user_model().objects.filter(pk__in=pk_list)
        insert = chatMessages(user_from=u_from,user_to=u_to,message=post['message'])
            resp['status'] = 'success'
        except Exception as ex:
            resp['status'] = 'failed'
            resp['mesg'] = ex
        resp['status'] = 'failed'

    return HttpResponse(json.dumps(resp), content_type="application/json")

I was trying to get messages in a variable correspondents, but when I try to output this variable through the chatMessages model, it gives an error that there should be ids in correspondents, although I seem to get them anyway my

class chatMessages(models.Model):
user_from = models.ForeignKey(User,
user_to = models.ForeignKey(User,
message = models.TextField()
date_created = models.DateTimeField(
correspondents = models.ForeignKey(User,
    on_delete=models.CASCADE,related_name="correspondents", null=True)

def __str__(self):
    return self.message

my html code:

<div class="container" style="height: 75%;">
<div class="card bg-dark h-100 border-light">
    <div class="card-body h-100">
        <div class="row h-100">
            <div class="col-md-4 border-right h-100">
                <div class="list-group bg-dark anyClass" id='user-list'>

                    {% for u in users %}
                    {% if not == 1 and not == %}
                    <a class="list-group-item {% if != chat_id %}bg-dark{% else %}bg-primary{% endif %} text-white" href="{% url 'chat-home' %}?u={{}}">
                            <p>{{u.first_name}} {{u.last_name}} ({{u.username}})</p>
                    {% endif %}
                    {% endfor %}
            <div class="col-md-8 h-100">
                {% if not chat_id > 0 %}
                <div class="h-100 d-flex flex-column justify-content-center align-items-center">
                    <h3>Начните общение!</h3>
                    <p><small class="text-muted">Выберете человека, чтобы написать ему.</small></p>
                {% else%}
                <div id="chat-box-field" class="h-100">
                    <div class="chat-box" style="height:80%">
                        {% for chat in chats %} {% if chat.user_from == user %}
                        <div class="p-2 w-100 d-flex justify-content-end">
                            <div class=" chat-bubble  ml-2 mb-2 bg-primary text-light rounded" data-id="{{}}">
                                <div class="d-flex justify-content-between"><small>Ты</small> <small>{{chat.date_created|date:"M-d-Y H:i"}}</small></div>
                        {% else %}
                        <div class="p-2 w-100 d-flex justify-content-start">
                            <div class="chat-bubble mr-2 mb-2 bg-light text-dark rounded" data-id="{{}}">
                                <div class=" d-flex justify-content-between"><small>От</small> <small>{{chat.date_created|date:"M-d-Y H:i"}}</small></div>
                        {% endif %} {% endfor %}
                    <div class="chat-box-form border-top p-2" style="height:20%">
                        <div class="w-100 h-100">
                            <form action="" id="chat-submit" class="h-100 d-flex ">
                                <input type="hidden" name="user_from" value="{{ }}">
                                <input type="hidden" name="user_to" value="{{ chat_id }}">
                                <div class="col-md-10 h-100">
                                    <textarea name="message" id="" class="h-100 w-100 form-control" placeholder="Написать"></textarea>
                                <button class="button btn btn-primary h-100 w-100 justify-content-center align-items-center d-flex">Отправить</button>
                {% endif %}
Back to Top