Search code examples
djangodjango-registration

Django Registration Registration_form


I'm using Django Registration_redux templates for user registrations. I am wondering how does Django know where to go when user submits his registration when action is action="." ?

{% 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 %}

Solution

  • If your action is blank or . then the post goes to the view (URL) which rendered the form.

    Here's a simple example using a contact form; https://hellowebapp.com/news/tutorial-setting-up-a-contact-form-with-django/