Skip to content

Instantly share code, notes, and snippets.

@svschannak
Created January 19, 2014 19:45
Show Gist options
  • Save svschannak/8510030 to your computer and use it in GitHub Desktop.
Save svschannak/8510030 to your computer and use it in GitHub Desktop.
Register all models to admin from app for Django.
app_models = get_app('app_name')
for model in get_models(app_models):
try:
admin.site.register(model)
except AlreadyRegistered:
pass
#use this if you want to register a model with specific definition
#admin.site.unregister(ModelName)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment