Register all api models with admin page
This commit is contained in:
parent
bfc757cace
commit
c1e682478b
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user