Fix running example management commands in Django 1.9
This commit is contained in:
@@ -4,9 +4,10 @@ This module is a scratchpad for general development, testing & debugging
|
||||
Well, even more so than pcmd.py. You best ignore p2cmd.py.
|
||||
"""
|
||||
import uuid
|
||||
import django
|
||||
|
||||
from django.core.management.base import NoArgsCommand
|
||||
from django.db.models import connection
|
||||
from django.db import connection
|
||||
from pprint import pprint
|
||||
import time, sys
|
||||
|
||||
@@ -14,7 +15,10 @@ from pexp.models import *
|
||||
|
||||
|
||||
def reset_queries():
|
||||
connection.queries = []
|
||||
if django.VERSION < (1, 9):
|
||||
connection.queries = []
|
||||
else:
|
||||
connection.queries_log.clear()
|
||||
|
||||
|
||||
def show_queries():
|
||||
|
||||
@@ -4,7 +4,7 @@ This module is a scratchpad for general development, testing & debugging.
|
||||
"""
|
||||
|
||||
from django.core.management.base import NoArgsCommand
|
||||
from django.db.models import connection
|
||||
from django.db import connection
|
||||
from pprint import pprint
|
||||
|
||||
from pexp.models import *
|
||||
|
||||
@@ -3,8 +3,9 @@
|
||||
This module is a scratchpad for general development, testing & debugging
|
||||
"""
|
||||
|
||||
import django
|
||||
from django.core.management.base import NoArgsCommand
|
||||
from django.db.models import connection
|
||||
from django.db import connection
|
||||
from pprint import pprint
|
||||
import sys
|
||||
from pexp.models import *
|
||||
@@ -13,7 +14,10 @@ num_objects = 1000
|
||||
|
||||
|
||||
def reset_queries():
|
||||
connection.queries = []
|
||||
if django.VERSION < (1, 9):
|
||||
connection.queries = []
|
||||
else:
|
||||
connection.queries_log.clear()
|
||||
|
||||
|
||||
def show_queries():
|
||||
|
||||
@@ -4,7 +4,7 @@ This module is a scratchpad for general development, testing & debugging
|
||||
"""
|
||||
|
||||
from django.core.management.base import NoArgsCommand
|
||||
from django.db.models import connection
|
||||
from django.db import connection
|
||||
from pprint import pprint
|
||||
|
||||
from pexp.models import *
|
||||
|
||||
Reference in New Issue
Block a user