Fix for removed `Q.clone()` method in Django 1.10

fix_request_path_info
Diederik van der Boor 2016-08-05 17:26:13 +02:00
parent 16586f398c
commit 2e694fb2c6
1 changed files with 4 additions and 1 deletions

View File

@ -4,6 +4,7 @@
"""
from __future__ import absolute_import
import copy
import django
from django.db import models
from django.contrib.contenttypes.models import ContentType
@ -100,7 +101,9 @@ def translate_polymorphic_filter_definitions_in_args(queryset_model, args, using
Returns: modified Q objects
"""
if django.VERSION >= (1, 6):
if django.VERSION >= (1, 10):
q_objects = [copy.deepcopy(q) for q in args]
elif django.VERSION >= (1, 6):
q_objects = [q.clone() for q in args]
else:
q_objects = args # NOTE: edits existing objects in place.