Skip to content

Instantly share code, notes, and snippets.

@carymrobbins
Last active August 29, 2015 14:09
Show Gist options
  • Save carymrobbins/f874e339c50646e5dcfb to your computer and use it in GitHub Desktop.
Save carymrobbins/f874e339c50646e5dcfb to your computer and use it in GitHub Desktop.
Get Django model by name
get_model_by_name = lambda name: next(m for m in __import__('django').db.models.get_models() if m.__name__ == name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment