首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Django注册Registration_form

Django注册Registration_form
EN

Stack Overflow用户
提问于 2017-02-13 09:41:23
回答 1查看 352关注 0票数 0

我正在使用Django Registration_redux模板进行用户注册。我想知道当用户提交注册时,当操作是action=".“时,Django如何知道去哪里?

代码语言:javascript
复制
{% extends "registration/registration_base.html" %}
{% load i18n %}

{% block title %}{% trans "Register for an account" %}{% endblock %}

{% block content %}
<form method="post" action="">
    {% csrf_token %}
    {{ form.as_p }}
    <input type="submit" value="{% trans 'Submit' %}" />
</form>
{% endblock %}


{% comment %}
**registration/registration_form.html**
Used to show the form users will fill out to register. By default, has
the following context:

``form``
    The registration form. This will be an instance of some subclass
    of ``django.forms.Form``; consult `Django's forms documentation
    <http://docs.djangoproject.com/en/dev/topics/forms/>`_ for
    information on how to display this in a template.
{% endcomment %}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-02-13 09:50:05

如果您的操作为空或.,那么post将转到呈现表单的视图(URL)。

下面是一个使用联系人表单的简单示例;https://hellowebapp.com/news/tutorial-setting-up-a-contact-form-with-django/

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42195432

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档