aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--pyblackbird_cc/resources/views.py13
-rw-r--r--pyblackbird_cc/templates/resources/resource_list.html1
2 files changed, 7 insertions, 7 deletions
diff --git a/pyblackbird_cc/resources/views.py b/pyblackbird_cc/resources/views.py
index ab12b64..1f68768 100644
--- a/pyblackbird_cc/resources/views.py
+++ b/pyblackbird_cc/resources/views.py
@@ -121,18 +121,19 @@ def index(request):
categories = ResourceCategory.objects.all()
category = request.GET.get('category', 'all')
- if category != 'all':
- resource_objs = resource_objs.filter(main_resource_category__name=category)
-
resource_list = [_extract_metadata_from_resource(r) for r in resource_objs]
- paginator = Paginator(resource_list, 20)
- page_number = request.GET.get('page')
- page_obj = paginator.get_page(page_number)
# Create a separate queryset for Featured resources
featured_resources = [r for r in resource_list if r.feature_slot]
featured_resources = sorted(featured_resources, key=lambda resource: resource.feature_slot)
+ if category != 'all':
+ resource_list = [r for r in resource_list if r.main_resource_category_name == category]
+
+ paginator = Paginator(resource_list, 20)
+ page_number = request.GET.get('page')
+ page_obj = paginator.get_page(page_number)
+
context = {
"page_obj": page_obj,
"categories": categories,
diff --git a/pyblackbird_cc/templates/resources/resource_list.html b/pyblackbird_cc/templates/resources/resource_list.html
index 5611bca..af1a126 100644
--- a/pyblackbird_cc/templates/resources/resource_list.html
+++ b/pyblackbird_cc/templates/resources/resource_list.html
@@ -11,7 +11,6 @@
</div>
{# featured resources #}
-{# TODO fix the tabbed navbar also fetching the selected Featured resources#}
{% if featured_resources %}
<div class="row my-4 text-center">
<h5 class="display-6">Featured resources</h5>