Python Django表单提交按钮不可单击/正在工作
这是我的模板代码Python Django表单提交按钮不可单击/正在工作,python,django,Python,Django,这是我的模板代码 {% block content %} <div class='main'> <form method='POST' action='/social/profile/' enctype='multipart/form-data'> {% csrf_token %} <h3>Select an image for your profile. Max 300x300 and 1mb.</h3> <br
{% block content %}
<div class='main'>
<form method='POST' action='/social/profile/' enctype='multipart/form-data'>
{% csrf_token %}
<h3>Select an image for your profile. Max 300x300 and 1mb.</h3>
<br/>
<img src="{{ image.url }}" alt="Profile Image" height="100px" width="100px" />
{{ form.profileimg.errors }}
{{ form.profileimg }}
{{ form.non_field_errors }}
<br/>
<h3>Enter or edit your details</h3> <br/>
<textarea name='text' cols='50' rows='3'>{{ text }}</textarea>
<h3>Current Workplace</h3>
<br/>
<input id="workplace" type="text" class="" name="workplace" value="{{ workplace }}">
<h3>Telephone Number</h3>
<br/>
<input id="telephone" type="text" class="" name="telephone" value="{{ telephone }}">
<h3>Address</h3>
<br/>
<textarea id="address" type="text" class="" name="address">{{ address }}</textarea>
<br/>
<input type="submit" value="Submit" >
</form>
</div>
{% endblock %}
{%block content%}
{%csrf_令牌%}
为您的个人资料选择一个图像。最大300x300和1mb。
{{form.profileimg.errors}
{{form.profileimg}}
{{form.non_field_errors}}
输入或编辑您的详细信息
{{text}}
当前工作场所
电话号码
地址
{{地址}
{%endblock%}
form.profileimg非常简单,只有一个ImageField
但由于某种原因,提交按钮无法单击?它在form.profileimg字段之前工作,我不能混合使用Django表单和普通html吗
浏览器来源:
<!DOCTYPE HTML>
<html>
<head>
<title>Social Network: Facemagazine</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="stylesheet" href="/static/social/css/main.css" />
</head>
<body class="loading">
<div id="wrapper">
<div id="bg"></div>
<div id="overlay"></div>
<div id="main">
<!-- Header -->
<header id="header" class="whitebox">
<h1> Facemagazine </h1>
<p>Worlds second best social network! </p>
<nav >
<ul>
<li><a class='icon' href='/social/members/?view=julian'> <h3> Home </h3> </a></li>
<li><a class='icon' href='/social/members/'> <h3>Members </h3> </a></li>
<li><a class='icon' href='/social/friends/'> <h3> Friends </h3> </a></li>
<li><a class='icon' href='/social/messages/'> <h3> Messages </h3> </a></li>
<li><a class='icon' href='/social/profile/'> <h3> Edit Profile </h3> </a></li>
<li><a class='icon' href='/social/logout/'> <h3> Log out </h3> </a></li>
</ul>
</nav>
<br>
<div class='main'>
<form method='POST' action='/social/profile/' enctype='multipart/form-data'>
<input type='hidden' name='csrfmiddlewaretoken' value='kire68pdevP0JZt8gTUYSsj6Dit1cgro' />
<h3>Select an image for your profile. Max 300x300 and 1mb.</h3>
<br/>
<img src="/media/profileimgs/no-img.jpg" alt="Profile Image" height="100px" width="100px" />
<input id="id_profileimg" name="profileimg" type="file" />
<br/>
<h3>Enter or edit your details</h3> <br/>
<textarea name='text' cols='50' rows='3'>Test Details</textarea>
<h3>Current Workplace</h3>
<br/>
<input id="workplace" type="text" class="" name="workplace" value="Workplacee">
<h3>Telephone Number</h3>
<br/>
<input id="telephone" type="text" class="" name="telephone" value="Telefon">
<h3>Address</h3>
<br/>
<textarea id="address" type="text" class="" name="address">adres</textarea>
<br/>
<input type="submit" value="Submit" >
</form>
</div>
<br>
</header>
<!-- Footer -->
<footer id="footer">
<span class="copyright">© Group 45</span>
</footer>
</div>
</div>
<!--[if lte IE 8]><script src="/static/social/js/ie/respond.min.js"></script><![endif]-->
<script>
window.onload = function() { document.body.className = ''; }
window.ontouchmove = function() { return false; }
window.onorientationchange = function() { document.body.scrollTop = 0; }
</script>
<script src="/static/social/scripts.js"/>
</body>
</html>
社交网络:Facemagazine
面杂志
世界第二好的社交网络
为您的个人资料选择一个图像。最大300x300和1mb。
输入或编辑您的详细信息
测试细节
当前工作场所
电话号码
地址
阿迪斯
&抄袭;第45组
window.onload=function(){document.body.className='';}
window.ontouchmove=函数(){return false;}
window.onorientationchange=function(){document.body.scrollTop=0;}
问题是页脚。CSS被弄乱了,所以不知何故被覆盖在按钮的顶部。它不应该与该字段有任何关系。当您通过浏览器查看源代码时,是否看到突出显示的错误?将实际的源代码发布到页面。浏览器->视图Source@JohnGordon张贴。没有显示错误。在表单末尾有两个输入,类型为submit
。都在展示吗?最后的标题标签应该在哪里?@souldeux是的,它们都显示出来,我放了两个,因为我只是在检查它是否与按钮标签或输入标签不同。(没有区别)标题标签很好,这只是一个学校作业,所以我没有太注意正确的格式,但CSS都显示为应该的。