Created
September 14, 2012 06:54
-
-
Save sergray/3720310 to your computer and use it in GitHub Desktop.
Print RST represention of Django model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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