Create Account for Django authentication Sadjcore Utilities to create a user account for a SmartAdmin for Django application.

Create a new account

Use the inline form to create an account on the Sadj demonstration server. Or use the button below to create a new account via a standalone page and login in a single operation.

This page also covers details of how to use the form in sadjcore to integrate account creation in your own projects.

Inline Create-User Form

Create-User form implemented as a Django form, handled within the page by sadjcore code.

Lowercase, no spaces.

Django Integration

The same form template is included into this page in inline mode, and into the standalone page.

There is a single register.html template and a corresponding UserCreationWithEmailForm form within sadjcore. The form is a standard Django form, inheriting from UserCreationForm, and therefore extensible with all the usual range of Django form capabilities. It also uses the Sadj helper templates to format form errors in a SmartAdmin-compatible way.

The create-and-login page uses the form with default arguments vis this line:

{% include 'sadjcore/forms/register.html' %}

The logic then follows the usual Django pattern: GET requests for the page and POST requests for the form are to the same url and handled by a simple view at sadjdemo.views.create_account_and_login

For the inline form on this page the template is included by:

{% include 'sadjcore/forms/register.html' with is_sadj_form=1 form_action='api/register/' %}

This adds a sadj-action="submit" attribue to the button, which invokes the sadjcore JavaScript to POST the form to the api/register url. The sadjdemo.views.register_user view returns either the populated form with errors in the event of a failure, or a new empty form and a success message.