|
7 | 7 | from django.utils.safestring import mark_safe
|
8 | 8 | from markdown import markdown as markdown_func
|
9 | 9 |
|
| 10 | +from base.main import ObjectList |
10 | 11 | from base.pagination import Pagination
|
11 | 12 |
|
12 | 13 |
|
@@ -35,23 +36,29 @@ def object_list(
|
35 | 36 | hits
|
36 | 37 | number of objects, total
|
37 | 38 | """
|
| 39 | + from cab.models import Snippet |
| 40 | + |
38 | 41 | if extra_context is None:
|
39 | 42 | extra_context = {}
|
40 | 43 | queryset = queryset._clone()
|
41 | 44 | model = queryset.model
|
42 | 45 | opts = model._meta
|
43 | 46 | if paginate_by:
|
44 |
| - pagination = Pagination(request, model, queryset, paginate_by) |
45 |
| - object_list = pagination.get_objects() |
| 47 | + if queryset.model == Snippet: |
| 48 | + object_list = ObjectList(request, queryset.model, queryset, 15) |
| 49 | + pagination = object_list.pagination |
| 50 | + else: |
| 51 | + pagination = Pagination(request, model, queryset, paginate_by) |
| 52 | + object_list = pagination.get_objects() |
46 | 53 |
|
47 | 54 | context = {
|
48 |
| - "%s_list" % template_object_name: object_list, |
| 55 | + "object_list": object_list, |
49 | 56 | "pagination": pagination,
|
50 | 57 | "hits": pagination.result_count,
|
51 | 58 | }
|
52 | 59 | else:
|
53 | 60 | context = {
|
54 |
| - "%s_list" % template_object_name: object_list, |
| 61 | + "object_list": queryset, |
55 | 62 | }
|
56 | 63 | if not allow_empty and len(queryset) == 0:
|
57 | 64 | raise Http404
|
|
0 commit comments