Browse administrators


Drag the divider or use the arrow keys to compare themes.
Django Chassis 1.0.23 · training site with Russian UI
- Administrators opens its dedicated list.
- The list includes staff accounts such as the training reader and administrator.
How to add it
With the users module enabled, the PlatformAdminSite in src/apps/admins/site.py registers /admin/pages/administrators/ automatically. Open Administrators as active staff with user view or change permission. Add this smoke test to src/apps/admins/tests/test_user_accounts.py for the standard Django user model.
src/apps/admins/tests/test_user_accounts.py
import pytest
from django.contrib.auth.models import User
from django.test import Client
from django.urls import reverse
@pytest.mark.django_db
def test_administrators_list(client: Client) -> None:
operator = User.objects.create_superuser(username='operator')
staff = User.objects.create_user(username='inactive-staff', is_staff=True, is_active=False)
user = User.objects.create_user(username='ordinary')
client.force_login(operator)
page = client.get(reverse('admin:chassis_page_administrators'))
assert page.status_code == 200
accounts = page.context['cl'].queryset
assert accounts.filter(pk=staff.pk).exists()
assert not accounts.filter(pk=user.pk).exists()