Code

Ticket #3181: list_detail.patch.txt

File list_detail.patch.txt, 1019 bytes (added by arockstar@…, 8 years ago)

Patch for list_detail

Line 
1Index: /Users/andrew/clownfish/django_src/django/views/generic/list_detail.py
2===================================================================
3--- /Users/andrew/clownfish/django_src/django/views/generic/list_detail.py      (revision 4105)
4+++ /Users/andrew/clownfish/django_src/django/views/generic/list_detail.py      (working copy)
5@@ -3,6 +3,7 @@
6 from django.core.xheaders import populate_xheaders
7 from django.core.paginator import ObjectPaginator, InvalidPage
8 from django.core.exceptions import ObjectDoesNotExist
9+from django.db.models.query import QuerySet
10 
11 def object_list(request, queryset, paginate_by=None, page=None,
12         allow_empty=False, template_name=None, template_loader=loader,
13@@ -35,7 +36,7 @@
14             number of objects, total
15     """
16     if extra_context is None: extra_context = {}
17-    queryset = queryset._clone()
18+    if isinstance(queryset, QuerySet): queryset = queryset._clone()
19     if paginate_by:
20         paginator = ObjectPaginator(queryset, paginate_by)
21         if not page: