mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2025-07-14 06:50:15 +02:00
This will prevent those weird missing UserProfile and AuthGroup errors. Add logging to authentication signals. Correct reverse migration authservicesinfo creation. Rename proxy models so they look better on the admin site.
34 lines
818 B
Python
34 lines
818 B
Python
from django.contrib import admin
|
|
from django.contrib.auth.models import Group as BaseGroup
|
|
from django.db.models.signals import post_save
|
|
|
|
from .models import AuthGroup, save_auth_group, create_auth_group
|
|
from .models import GroupRequest
|
|
|
|
|
|
class AuthGroupAdmin(admin.ModelAdmin):
|
|
"""
|
|
Admin model for AuthGroup
|
|
"""
|
|
filter_horizontal = ('group_leaders',)
|
|
|
|
|
|
class Group(BaseGroup):
|
|
class Meta:
|
|
proxy = True
|
|
verbose_name = BaseGroup._meta.verbose_name
|
|
verbose_name_plural = BaseGroup._meta.verbose_name_plural
|
|
|
|
try:
|
|
admin.site.unregister(BaseGroup)
|
|
finally:
|
|
admin.site.register(Group)
|
|
|
|
|
|
admin.site.register(GroupRequest)
|
|
admin.site.register(AuthGroup, AuthGroupAdmin)
|
|
|
|
|
|
post_save.connect(create_auth_group, sender=Group)
|
|
post_save.connect(save_auth_group, sender=Group)
|