mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-12 10:06:21 +01:00
Capture signals sent by admin proxy models.
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.
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from django.contrib import admin
|
||||
from django.contrib.auth.models import Group
|
||||
from django.contrib.auth.models import Group as BaseGroup
|
||||
from django.db.models.signals import post_save
|
||||
|
||||
from .models import AuthGroup
|
||||
from .models import AuthGroup, save_auth_group, create_auth_group
|
||||
from .models import GroupRequest
|
||||
|
||||
|
||||
@@ -12,17 +13,21 @@ class AuthGroupAdmin(admin.ModelAdmin):
|
||||
filter_horizontal = ('group_leaders',)
|
||||
|
||||
|
||||
class ProxyGroup(Group):
|
||||
class Group(BaseGroup):
|
||||
class Meta:
|
||||
proxy = True
|
||||
verbose_name = Group._meta.verbose_name
|
||||
verbose_name_plural = Group._meta.verbose_name_plural
|
||||
verbose_name = BaseGroup._meta.verbose_name
|
||||
verbose_name_plural = BaseGroup._meta.verbose_name_plural
|
||||
|
||||
try:
|
||||
admin.site.unregister(Group)
|
||||
admin.site.unregister(BaseGroup)
|
||||
finally:
|
||||
admin.site.register(ProxyGroup)
|
||||
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)
|
||||
|
||||
@@ -15,7 +15,7 @@ class Migration(migrations.Migration):
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='ProxyGroup',
|
||||
name='Group',
|
||||
fields=[
|
||||
],
|
||||
options={
|
||||
|
||||
Reference in New Issue
Block a user