Skip to content

Latest commit

 

History

History
69 lines (44 loc) · 1.79 KB

README.rst

File metadata and controls

69 lines (44 loc) · 1.79 KB

Django GroupAdmin Users

Build Status Coverage Status PyPI version

Edit users in group from the Group add and edit pages.

Credit goes to this Stack Overflow answer

Installation

Works with Django version 1.8 to 3.2.

Tested with Django-supported Python versions.

Install with:

pip install django-groupadmin-users

Usage

Add ''groupadmin_users'' to INSTALLED_APPS after ''django.contrib.auth''. That's it.

Alternatively, don't add ''groupadmin_users'' to INSTALLED_APPS, but use and further customize this code:

from django.contrib import admin
from django.contrib.auth.models import Group

from groupadmin_users.forms import GroupAdminForm


# Unregister the original Group admin.
admin.site.unregister(Group)


# Create a new Group admin.
class GroupAdmin(admin.ModelAdmin):
    # Use our custom form.
    form = GroupAdminForm
    # Filter permissions horizontal as well.
    filter_horizontal = ['permissions']

# Register the new Group ModelAdmin.
admin.site.register(Group, GroupAdmin)

Demo

Example image from Stack Overflow answer: