aboutsummaryrefslogtreecommitdiffstats
path: root/pyblackbird_cc/resources/views.py
diff options
context:
space:
mode:
authorMatthew Lemon <y@yulqen.org>2024-05-26 16:49:34 +0100
committerMatthew Lemon <y@yulqen.org>2024-05-26 16:49:34 +0100
commit37698a2ebba6ea366b93f70f6ad87336b302b70c (patch)
tree83bc29a8b9574cbf6091d8afc7cdf5ef7a56d211 /pyblackbird_cc/resources/views.py
parentb3c7d985a50a38fcb19d8e9f91b5b719d43e31a4 (diff)
Better presentation of the feature resources
Diffstat (limited to 'pyblackbird_cc/resources/views.py')
-rw-r--r--pyblackbird_cc/resources/views.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/pyblackbird_cc/resources/views.py b/pyblackbird_cc/resources/views.py
index 8eea5b3..ea8953f 100644
--- a/pyblackbird_cc/resources/views.py
+++ b/pyblackbird_cc/resources/views.py
@@ -30,6 +30,7 @@ class ResourceInfo:
id: int
name: str
description: str
+ card_description: str
main_resource_category_name: str
additional_resource_category_name: str | None
age_range: str | None
@@ -91,6 +92,7 @@ def _extract_metadata_from_resource(resource_obj) -> ResourceInfo | None:
id=resource_obj.id,
name=resource_obj.name,
description=resource_obj.description,
+ card_description=resource_obj.card_description,
main_resource_category_name=resource_obj.main_resource_category.name,
additional_resource_category_name=arc_name,
age_range=resource_obj.age_range,
@@ -112,7 +114,6 @@ def _extract_metadata_from_resource(resource_obj) -> ResourceInfo | None:
def index(request):
resource_objs = Resource.objects.all()
resource_list = [_extract_metadata_from_resource(r) for r in resource_objs]
- # featured_resources = Resource.objects.filter(feature_slot__gt=0).all()
featured_resources = [r for r in resource_list if r.feature_slot]
featured_resources = sorted(featured_resources, key=lambda resource: resource.feature_slot)
context = {"resource_list": resource_list, "featured_resources": featured_resources}
@@ -245,6 +246,7 @@ def create_resource(request):
thumbnail_files = form.cleaned_data["thumbnail_files"]
name = form.cleaned_data["name"]
description = form.cleaned_data["description"]
+ card_description = form.cleaned_data["card_description"]
resource_type = form.cleaned_data["resource_type"]
age_range = form.cleaned_data["age_range"]
curriculum = form.cleaned_data["curriculum"]
@@ -256,6 +258,7 @@ def create_resource(request):
resource = Resource.objects.create(
name=name,
description=description,
+ card_description=card_description,
resource_type=resource_type,
age_range=age_range,
curriculum=curriculum,