Не передается content из views в html Django

Не передаются данные из views в html

#Views

from django.template.loader import render_to_string
from django.core.mail import EmailMessage
from django.shortcuts import render, redirect
from .forms import *
from django.views.generic import View
from django.core.mail import send_mail


class FeedBackView(View):
    def post(self, request):
        global context
        if request.method == 'POST':
            form = FeedBackForm(request.POST)
            html_template = 'message.html'
            if form.is_valid():
                context = {
                        'inn': form.cleaned_data['inn'],
                        'name_debtor': form.cleaned_data['name_debtor'],
                        'sum': form.cleaned_data['sum'],
                        'judgment': form.cleaned_data['judgment'],
                        'performance': form.cleaned_data['performance'],
                        'name': form.cleaned_data['name'],
                        'email': form.cleaned_data['email'],
                        'phone': form.cleaned_data['phone']
                }

            html_message = render_to_string(html_template, { 'context': context, })

            mail = EmailMessage(form.cleaned_data['name'], html_message, 'dev@makarenko.tech',
                                 ['sergeimakarenko5991@gmail.com'])
            mail.content_subtype = 'html'  # this is required because there is no plain text email message
            mail.send()

            if mail:
                print('success_message')
                form.save()
                return redirect('feedback_success')
            else:
                print('error_message')
        else:
            form = FeedBackForm()

def feedback_success(request):
    return render(request, 'feedback/feedback_success.html')

#html

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <title>Order received</title>
  <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
</head>
<body style="margin: 0; padding: 0;">
  <table align="center" border="0" cellpadding="0" cellspacing="0" width="320" style="border: none; border-collapse: collapse; font-family:  Arial, sans-serif; font-size: 14px; line-height: 1.5;">
      {% block content %}

      <ul>
          {% for post.message in post.messag %}
            <li>{{ message }} 1</li>
          {% endfor %}
          <li>{{ post.message }} 1</li>
          <li>{{ message }} 2</li>
      </ul>
      {% endblock %}
</table>
</body>
</html>

Вернуться на верх