How to take data from the admin using Django forms?

I want when the user to select multiple users, a pop-up form will appear and he can send emails after submitting the form to the selected users

This is

class ReplyForm(forms.Form):
    message = forms.CharField(widget=forms.Textarea)

class ContactUsAdmin(admin.ModelAdmin):
    actions = ['reply_by_email']
    list_display = ("id", "first_name", "last_name", "email",
                    "phone_number", "created_at", "message")
    search_fields = ("first_name", "last_name", "email", "phone_number", "message")

    def reply_by_email(self, request, queryset):
        if request.POST:
            form = ReplyForm(request.POST)

            if form.is_valid():

                subject = "Custom email from admin"
                message = form.cleaned_data['message']
                from_email = ""
                recipient_list = [ for user in queryset]
                send_mail(subject, message, from_email, recipient_list)
                # check the form's errors
            form = ReplyForm(request.POST or None)

        context = self.admin_site.each_context(request)
        context['form'] = form
        context['queryset'] = queryset
        return TemplateResponse(request, "reply_by_email.html", context)

    reply_by_email.short_description = "Send email to selected users"

this is reply_by_email.html:

{% load i18n %}

{% block content %}
<form method="post" enctype="multipart/form-data">
    {% csrf_token %}
    {{ form.as_p }}
    <input type="submit" name="apply" value="Send Email">
{% endblock %}

when the admin fill the form nothing happens

Iam expecting a message from the user

Back to Top