Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/django/20.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 django codemirror从编辑器获取代码_Python_Django_Codemirror - Fatal编程技术网

Python django codemirror从编辑器获取代码

Python django codemirror从编辑器获取代码,python,django,codemirror,Python,Django,Codemirror,下面是我在模板中为代码编辑器编写的代码 {% load static %} <script src="{% static 'codemirror.js' %}"></script> <link rel="stylesheet" href="{% static 'codemirror.css' %}"> <script src="{% static 'clike.js' %}"></script> <script> var

下面是我在模板中为代码编辑器编写的代码

{% load static %}
<script src="{% static 'codemirror.js' %}"></script>
<link rel="stylesheet" href="{% static 'codemirror.css' %}">
<script src="{% static 'clike.js' %}"></script>

<script>

var myCodeMirror = CodeMirror(document.getElementById('text_area'), {
  value: "int main()",
  mode: "text/x-c++src",
  lineNumbers: true,
  indentUnit: 4,
});
</script>
{%load static%}
var mycodeirror=CodeMirror(document.getElementById('text_area'){
值:“int main()”,
模式:“text/x-c++src”,
行号:对,
单位:4,
});
使用div标记

<div id="text_area" name="text_area" style="margin-top: 0px;" ></div>

如何从post方法中获取提交按钮后的代码

注:
我正在使用来自

的CodeMirror库,您应该能够使用

myCodeMirror.getValue()