Skip to content

Instantly share code, notes, and snippets.

@sergray
Created September 14, 2012 06:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergray/3720310 to your computer and use it in GitHub Desktop.
Save sergray/3720310 to your computer and use it in GitHub Desktop.
Print RST represention of Django model
def text_model(M):
print M.__name__
print '~' * len(M.__name__)
print '-', '\n- '.join('%s: %s' % (f.name, f.__class__.__name__) for f in M._meta.fields)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment