我收到错误,找不到页面。 在profile.html中,我写了
export default class TestComp extends Component {
constructor(props) {
super(props);
this.state = {
viewPermission : true,
createPermission] : true,
editPermission] : true,
deletePermission] : true
};
}
// Rest of your component methods such as render and others
在这部分
<!DOCTYPE html>
<html lang="ja">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>UPLOAD</title>
</head>
<body>
<form action="registration/accounts/fashion_result.html">
<input type="submit" value="ResultShow">
</form>
<div class="container">
<form action="{% url 'accounts:upload_save' %}" method="POST" enctype="multipart/form-data">
{% csrf_token %}
<input type="file" name="files[]" multiple>
<input type="hidden" value="{{ p_id }}" name="p_id">
<input type="submit" value="Upload">
</form>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
</body>
</html>
我想进行屏幕转换(如果我按下此按钮,我想在浏览器中看到fashion_result.html。
但现在,我收到了错误。 我该如何解决这个问题?
此外,我加入了urls.py
<form action="registration/accounts/fashion_result.html">
<input type="submit" value="ResultShow">
</form>
profile.html中的
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
urlpatterns = patterns('',
url(r'^/fashionresults/$', TemplateView.as_view(template_name='registration/accounts/fashion_result.html'), name='fashionresults'
)
(在目录中,有fashion_result.html)
答案 0 :(得分:2)
用户模板View解决此问题
from django.conf.urls import patterns, url
from django.views.generic import TemplateView
urlpatterns = patterns('',
url(r'^/test/$', TemplateView.as_view(template_name='todo/index.html'), name="test"),
)
在html页面
<a href="{% url 'test' %}" >ResultShow</a>
答案 1 :(得分:0)
这对你有用: -
模板 -
<form action="/fashion_result">
<input type="submit" value="ResultShow">
</form>
urls.py: -
from django.conf.urls import url,include
from webpage import views
# from django.conf import settings
urlpatterns = [
url(r'^$',views.home),
url(r'^fashion_result/$',views.fashionResult),
views.py -
from django.shortcuts import render
import json
def home(request):
return render(request, 'home.html')
def fashionResult(request):
return render(request, 'registration/accounts/fashion_result.html')
答案 2 :(得分:0)
如果文件位于同一文件夹中,则取决于文件所在的位置
<form action="fashion_result.html">
或者做一件事 &#34; Shift +右键单击&#34;然后&#34;复制为路径&#34;
回来并粘贴&#34;表格动作&#34;绝对有效。