Add Django admin site
This commit is contained in:
parent
5d7103081c
commit
56d3a1a862
|
@ -1,3 +1,10 @@
|
|||
from django.apps import apps
|
||||
from django.contrib import admin
|
||||
from django.contrib.admin.sites import AlreadyRegistered
|
||||
|
||||
# Register your models here.
|
||||
app_models = apps.get_app_config('api').get_models()
|
||||
for model in app_models:
|
||||
try:
|
||||
admin.site.register(model)
|
||||
except AlreadyRegistered:
|
||||
pass
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
from django.conf.urls import url
|
||||
from django.contrib import admin
|
||||
from django.urls import include, path
|
||||
from rest_framework import routers
|
||||
from .api import views
|
||||
|
@ -7,6 +9,7 @@ router.register(r'users', views.UserViewSet)
|
|||
|
||||
urlpatterns = [
|
||||
path('', include(router.urls)),
|
||||
path('admin/', admin.site.urls),
|
||||
path('api-auth/', include('rest_framework.urls', namespace='rest_framework')),
|
||||
url(r'^rest-auth/', include('rest_auth.urls')),
|
||||
url(r'^rest-auth/registration/', include('rest_auth.registration.urls')),
|
||||
|
|
Loading…
Reference in New Issue
Block a user