Getting Started

Install

Accounts

SuperDjango offers a suite of Django apps related to account management, including:

  • authentication
  • avatars
  • badges
  • impersonation
  • invitations
  • locking
  • multi-SSO support
  • password management
  • profiles
  • registrations
  • SSO

Setup

Select the apps you wish to use and add them to INSTALLED_APPS. In this example, we've selected authentication and password management.

# settings.py
INSTALLED_APPS = [
    # ...
    "superdjango.contrib.accounts.auth.apps.DefaultConfig",
    "superdjango.contrib.accounts.passwords.apps.DefaultConfig",
]

The AccountsViewSet class is provided to assist with adding the appropriate URLs:

# urls.py
# ...
from superdjango.contrib.accounts.viewsets import AccountsViewSet

accounts = AccountsViewSet(auth=True, passwords=True)

urlpatterns = [
    path('admin/', admin.site.urls),
    path('accounts/', include(accounts.get_urls())),
    # ...
]

User Interface

SuperDjango UI works something like the Django Admin. In this brief introduction, it is best to explain with code.

ModelUI

Support you have a project model that looks something like this:

# projects/models.py
class Project(models.Model):
    description = models.TextField(blank=True)

    due_date = models.DateField(blank=True)

    title = models.CharField(max_length=128)

    class Meta:
        verbose_name = _("Project")
        verbose_name_plural = _("Projects") 

You may configure a model UI like so:

# projects/ui.py
from superdjango import ui
from .models import Project

class ProjectUI(ui.ModelUI):
    model = Project

    form_options = ui.FormOptions(
        "title",
        "description",
        "due_date"
    )

    list_options = ui.ListOptions(
        "title",
        "due_date"
    )

The project (and any other model UIs) can be made available using a menu:

# projects/ui.py
from superdjango import ui
# ...

class ProjectsMenu(ui.Menu):
    items = [
        ProjectUI,
        # ...
    ]


ui.site.register(ProjectsMenu)

Add the UI app to your INSTALLED_APPS:

INSTALL_APPS = [
    # ...
    'superdjango.ui.apps.AutoConfig',
]

And then incorporate the URLs:

# urls.py
from superdjango.ui import site

urlpatterns = [
    path('admin/', admin.site.urls),
    path('apps/', include(site.get_urls())),
]