Skip to content

Commit

Permalink
Merge pull request #3767 from unicef/fix-admin-authtoken-loading
Browse files Browse the repository at this point in the history
Admin: raw id for user on auth Token model
  • Loading branch information
robertavram authored Sep 18, 2024
2 parents dc5150a + d1ecfb3 commit 74bd1e7
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/etools/applications/users/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
from django_tenants.admin import TenantAdminMixin
from django_tenants.postgresql_backend.base import FakeTenant
from django_tenants.utils import get_public_schema_name
from rest_framework.authtoken.admin import TokenAdmin
from rest_framework.authtoken.models import TokenProxy
from unicef_snapshot.admin import ActivityInline, SnapshotModelAdmin

from etools.applications.funds.tasks import sync_all_delegated_frs, sync_country_delegated_fr
Expand Down Expand Up @@ -531,10 +533,18 @@ def has_change_permission(self, request, obj=None):
return False


class CustomTokenAdmin(TokenAdmin):
raw_id_fields = ('user',)


# Re-register UserAdmin
admin.site.register(get_user_model(), UserAdminPlus)
admin.site.register(UserProfile, ProfileAdmin)
admin.site.register(Country, CountryAdmin)
admin.site.register(WorkspaceCounter)
admin.site.register(Realm, RealmAdmin)
admin.site.register(StagedUser, StagedUserAdmin)


admin.site.unregister(TokenProxy)
admin.site.register(TokenProxy, CustomTokenAdmin)

0 comments on commit 74bd1e7

Please sign in to comment.