diff --git a/README.md b/README.md index 2700d3c8..40ea0dbc 100644 --- a/README.md +++ b/README.md @@ -788,6 +788,8 @@ admin.site.register(User, CustomUserAdmin) ![image](https://github.com/dldevinc/paper-admin/assets/6928240/72766127-ccc6-4538-ac4f-5dae14a30e1f) +For permission fields, you can take it a step further and utilize [paper-admin-permission-field](https://github.com/dldevinc/paper-admin-permission-field). + ## Settings `PAPER_FAVICON`
diff --git a/paper_admin/__init__.py b/paper_admin/__init__.py index 27569561..48330fec 100644 --- a/paper_admin/__init__.py +++ b/paper_admin/__init__.py @@ -1,2 +1,2 @@ -__version__ = "7.6.4" +__version__ = "7.7.0" default_app_config = "paper_admin.apps.Config" diff --git a/tests/users/admin.py b/tests/users/admin.py index b9e07fa6..8f398076 100644 --- a/tests/users/admin.py +++ b/tests/users/admin.py @@ -1,11 +1,23 @@ +from django import forms from django.contrib import admin -from django.contrib.auth.admin import UserAdmin +from django.contrib.auth.admin import GroupAdmin, UserAdmin from django.contrib.auth.forms import UserChangeForm -from django.contrib.auth.models import User +from django.contrib.auth.models import Group, User from paper_admin.admin.widgets import AdminCheckboxTree +class GroupAdminForm(forms.ModelForm): + class Meta: + widgets = { + "permissions": AdminCheckboxTree, + } + + +class CustomGroupAdmin(GroupAdmin): + form = GroupAdminForm + + class CustomUserChangeForm(UserChangeForm): class Meta: widgets = { @@ -18,4 +30,6 @@ class CustomUserAdmin(UserAdmin): admin.site.unregister(User) +admin.site.unregister(Group) admin.site.register(User, CustomUserAdmin) +admin.site.register(Group, CustomGroupAdmin)