Skip to content

Registration custom class for in django admin #898

@folt

Description

@folt

I am getting an issue with admin page extension. When I do
admin.site.register (AccessToken, AccessTokenAdmin)
where AccessTokenAdmin is my class, then I get the error "The model AccessToken is already registered".

I propose a solution when you can specify a class file for the django administration panel:
ACCESS_TOKEN_ADMIN = getattr (settings, "OAUTH2_PROVIDER_ACCESS_TOKEN_ADMIN", "custom.AccessToken")

Currently, we have to solve this problem as follows:

if not admin.site.is_registered (AccessToken):
     admin.site.register (AccessToken, AccessTokenAdmin)

I'm willing to contribute if the community supports it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions