create_smarter_admin

This module provides a Django management command to create or update a superuser (“Smarter admin”).

account, user profile, and a corresponding API key for the platform.

Classes

Command

Implements the logic for the manage.py create_smarter_admin command.

Command-line Arguments

-u, –usernamestr, optional

The username for the new superuser (defaults to value from settings).

-e, –emailstr, optional

The email address for the new superuser (defaults to username@domain).

-p, –passwordstr, optional

The password for the new superuser. If not specified, a random password is generated.

Functionality

  • Ensures there is a platform admin account in the system, fully populated.

  • Creates or updates User and UserProfile for the superuser.

  • Creates a default AccountContact if absent.

  • Creates and displays a new API key (auth token) for the superuser if one does not exist.

  • Most account and contact attributes are populated from configuration settings.

Usage Example

python manage.py create_smarter_admin –username=admin –email=admin@example.com –password=s3cret

class smarter.apps.account.management.commands.create_smarter_admin.Command(*args, **kwargs)[source]

Bases: SmarterCommand

Create a new Smarter superuser.

add_arguments(parser)[source]

Add arguments to the command.

handle(*args, **options)[source]

Create the superuser account.