Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/332.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python HTMLCalendar显示为字符串,而不是正确使用HTML(Django)_Python_Html_Django - Fatal编程技术网

Python HTMLCalendar显示为字符串,而不是正确使用HTML(Django)

Python HTMLCalendar显示为字符串,而不是正确使用HTML(Django),python,html,django,Python,Html,Django,我试图在django项目中显示一个HTMLCalendar,但它只显示html代码,而不是实际的日历 views.py def CalendarView(request): cal = HTMLCalendar().formatmonth(2020, 10, withyear=True).replace('<td ', '<td width="150" height="150"') return render(reques

我试图在django项目中显示一个HTMLCalendar,但它只显示html代码,而不是实际的日历

views.py

def CalendarView(request):

    cal = HTMLCalendar().formatmonth(2020, 10, withyear=True).replace('<td ', '<td  width="150" height="150"')

    return render(request, 'calendar.html', {'cal': cal})

def日历视图(请求):
cal=HTMLCalendar().formatmonth(2020,10,withyear=True)。替换('
{%  extends 'base.html' %}

{% block tilte %} Home {% endblock %}
{% block body %}


  <div id="content-main">
          <ul class="object-tools">
            <li>
                <a href={{ previous_month }}>
                    Previous month
                </a>
            </li>
            <li>
                <a href={{ next_month }}>
                    Next month
                </a>
            </li>
        </ul>

        {{ cal }}

{% endblock %}