Register all api models with admin page

This commit is contained in:
Tanner Collin 2020-01-29 23:42:44 +00:00
parent bfc757cace
commit c1e682478b

View File

@ -1,3 +1,10 @@
from django.apps import apps
from django.contrib import admin 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