Last active
November 30, 2016 15:37
-
-
Save strokirk/848bc121307880572f57f1e524a8aabd to your computer and use it in GitHub Desktop.
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 django_model_values(obj): | |
| fields = obj._meta.get_fields() | |
| field_values = [(f.name, f.value_from_object(obj)) for f in fields if hasattr(f, "value_from_object")] | |
| return field_values | |
| print("%r\n" % f + "\n".join(" %s: %r" % tup for tup in django_model_values(obj))) | |
| def test_querie(): | |
| from django.conf import settings | |
| from django.db import connection | |
| from django.db import reset_queries | |
| settings.DEBUG = True | |
| reset_queries() | |
| # tests | |
| print("================") # XXX | |
| print(connection.queries) # XXX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment