Created
January 4, 2012 17:21
-
-
Save tomviner/1561066 to your computer and use it in GitHub Desktop.
Print django database query with a little formatting
This file contains 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
# eg qs = Product.objects.exclude(is_prebuy=True) | |
print re.sub(r'\b([A-Z]+)\b', r'\n\1\n\t', str(qs.query)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment