Skip to content

Instantly share code, notes, and snippets.

@michaelschade
Created September 27, 2010 02:51
Show Gist options
  • Save michaelschade/598529 to your computer and use it in GitHub Desktop.
Save michaelschade/598529 to your computer and use it in GitHub Desktop.
# Change to import the proper model object
from package import models
# Leave alone
from django.db.models.base import ModelBase
from django.contrib import admin
from inspect import getmembers
for model in getmembers(models):
if type(model[1]) == ModelBase: # model[1] is the actual object
admin.site.register(model[1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment