形成在Django不发布 [英] Form not Posting in Django

查看:123
本文介绍了形成在Django不发布的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图做一些Django的pretty基本形式的职位,但每当我试着点击按钮提交的信息没有任何反应。任何种类的任何错误或消息在终端或者在Chrome开发者露面。有这个页面只是直接的HTML上没有JS:

I'm trying to do some pretty basic form posts with Django, but whenever I try to click on the button to submit the information nothing happens. No errors or messages of any kind show up in terminal or in developer in Chrome. There is no JS on this page just straight html:

<form method="post" action="/">
    {% csrf_token %}
    <input type="text" id="name" name="name"/>
    <input type="text" id="password" name="password"/>
    <input type="button" value="Sign Up!"/>
</form>

我给这页的看法是pretty直截了当,以及:

My view for this page is pretty straightforward as well:

def sign_up(request):
    return render_to_response('portal/signup.html', context_instance=RequestContext(request))

我真的感到困惑,这是怎么回事,我一直在关注这个学习认证。一切正常,但我想增加一个创建用户将是下一个步骤。我似乎无法得到任何形式的任何一种在其他网页正常工作。

I'm really baffled as to what is going on, I've been following this to learn authentication. Everything works but I thought adding a "create user" would be a next step. I can't seem to get any form of any kind to work on other pages as well.

任何帮助将是巨大的,我要疯了!

Any help would be great, I'm going crazy!

推荐答案

我觉得你的问题是,你正在使用

I think that your problem is that you're using

<input type="button" value="Sign Up!"/>

而不是

<input type="submit" value="Sign Up!"/>

输入提交将所有的表单数据发送到服务器,输入按钮不会。
你可以了解更多一点关于这里的形式:
http://www.w3schools.com/html/ html_forms.asp

这篇关于形成在Django不发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆