From 71767431ebe662985816aeb69e8988c5847be8a2 Mon Sep 17 00:00:00 2001 From: Gavin Wahl Date: Fri, 24 May 2013 15:13:34 -0600 Subject: [PATCH] Django 1.6 support CHUNK_SIZE has been removed from Django, so set it ourself if it can't be imported. --- polymorphic/query.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/polymorphic/query.py b/polymorphic/query.py index 22cadf0..7f6d70d 100644 --- a/polymorphic/query.py +++ b/polymorphic/query.py @@ -15,7 +15,11 @@ from .query_translate import translate_polymorphic_field_path # chunk-size: maximum number of objects requested per db-request # by the polymorphic queryset.iterator() implementation; we use the same chunk size as Django -from django.db.models.query import CHUNK_SIZE # this is 100 for Django 1.1/1.2 +try: + from django.db.models.query import CHUNK_SIZE # this is 100 for Django 1.1/1.2 +except ImportError: + # CHUNK_SIZE was removed in Django 1.6 + CHUNK_SIZE = 100 Polymorphic_QuerySet_objects_per_request = CHUNK_SIZE