mirror of
https://gitlab.crans.org/bde/nk20
synced 2024-12-22 23:42:25 +00:00
Add Django OAuth toolkit admin
This commit is contained in:
parent
6d54aae614
commit
72bac75fbd
@ -26,6 +26,14 @@ admin_site = StrongAdminSite()
|
||||
admin_site.register(Site, SiteAdmin)
|
||||
|
||||
# Add external apps model
|
||||
if "oauth2_provider" in settings.INSTALLED_APPS:
|
||||
from oauth2_provider.admin import Application, ApplicationAdmin, Grant, \
|
||||
GrantAdmin, AccessToken, AccessTokenAdmin, RefreshToken, RefreshTokenAdmin
|
||||
admin_site.register(Application, ApplicationAdmin)
|
||||
admin_site.register(Grant, GrantAdmin)
|
||||
admin_site.register(AccessToken, AccessTokenAdmin)
|
||||
admin_site.register(RefreshToken, RefreshTokenAdmin)
|
||||
|
||||
if "django_htcpcp_tea" in settings.INSTALLED_APPS:
|
||||
from django_htcpcp_tea.admin import *
|
||||
from django_htcpcp_tea.models import *
|
||||
|
@ -38,7 +38,9 @@ INSTALLED_APPS = [
|
||||
'oauth2_provider',
|
||||
|
||||
# Django contrib
|
||||
'django.contrib.admin',
|
||||
# We do not import Django Admin directly to disable autodiscover.
|
||||
# Autodiscover does not work with custom admin sites.
|
||||
'django.contrib.admin.apps.SimpleAdminConfig',
|
||||
'django.contrib.admindocs',
|
||||
'django.contrib.auth',
|
||||
'django.contrib.contenttypes',
|
||||
|
@ -32,9 +32,6 @@ urlpatterns = [
|
||||
path('api/', include('api.urls')),
|
||||
path('permission/', include('permission.urls')),
|
||||
|
||||
# OAuth2 provider
|
||||
path('o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
|
||||
|
||||
# Make coffee
|
||||
path('coffee/', include('django_htcpcp_tea.urls')),
|
||||
]
|
||||
@ -43,6 +40,11 @@ urlpatterns = [
|
||||
if settings.DEBUG:
|
||||
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
||||
if "oauth2_provider" in settings.INSTALLED_APPS:
|
||||
# OAuth2 provider
|
||||
urlpatterns.append(
|
||||
path('o/', include('oauth2_provider.urls', namespace='oauth2_provider'))
|
||||
)
|
||||
|
||||
if "debug_toolbar" in settings.INSTALLED_APPS:
|
||||
import debug_toolbar
|
||||
|
Loading…
Reference in New Issue
Block a user