aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--pyblackbird_cc/resources/admin.py6
-rw-r--r--pyblackbird_cc/resources/views.py8
-rw-r--r--pyblackbird_cc/templates/resources/resource_detail.html36
3 files changed, 27 insertions, 23 deletions
diff --git a/pyblackbird_cc/resources/admin.py b/pyblackbird_cc/resources/admin.py
index 1140c35..302f5ca 100644
--- a/pyblackbird_cc/resources/admin.py
+++ b/pyblackbird_cc/resources/admin.py
@@ -1,6 +1,7 @@
# Register your models here.
from django.contrib import admin
+from pyblackbird_cc.resources.models import Resource
from pyblackbird_cc.resources.models import ResourceCategory
from pyblackbird_cc.resources.models import ResourceType
@@ -13,3 +14,8 @@ class ResourceTypeAdmin(admin.ModelAdmin):
@admin.register(ResourceCategory)
class ResourceCategoryAdmin(admin.ModelAdmin):
pass
+
+
+@admin.register(Resource)
+class ResourceAdmin(admin.ModelAdmin):
+ pass
diff --git a/pyblackbird_cc/resources/views.py b/pyblackbird_cc/resources/views.py
index b09f37e..c3e79ff 100644
--- a/pyblackbird_cc/resources/views.py
+++ b/pyblackbird_cc/resources/views.py
@@ -86,8 +86,8 @@ def _extract_metadata_from_resource(resource_obj) -> ResourceInfo | None:
snapshot_urls=snapshot_url_dict,
thumbnail_filenames=resource_obj.thumbnail_filenames,
thumbnail_urls=thumbnail_urls,
- created=resource_obj.created_at.strftime("%Y-%m-%d %H:%M:%S"),
- updated=resource_obj.updated_at.strftime("%Y-%m-%d %H:%M:%S"),
+ created=resource_obj.created_at,
+ updated=resource_obj.updated_at,
)
except Exception as e:
logging.exception(f"Error extracting resource information: {e}")
@@ -232,9 +232,7 @@ def create_resource(request):
age_range = form.cleaned_data["age_range"]
curriculum = form.cleaned_data["curriculum"]
main_resource_category = form.cleaned_data["main_resource_category"]
- additional_resource_category = form.cleaned_data[
- "additional_resource_category"
- ]
+ additional_resource_category = form.cleaned_data["additional_resource_category"]
try:
resource = Resource.objects.create(
diff --git a/pyblackbird_cc/templates/resources/resource_detail.html b/pyblackbird_cc/templates/resources/resource_detail.html
index 605f6bb..0bfdf92 100644
--- a/pyblackbird_cc/templates/resources/resource_detail.html
+++ b/pyblackbird_cc/templates/resources/resource_detail.html
@@ -7,7 +7,7 @@
<h3>{{ resource.name }}</h3>
<div class="d-flex flex-row justify-content-between my-3">
<div>
- <span class="fw-bold">Subject:</span>{{ resource.main_resource_category }}
+ <span class="fw-bold">Subject:</span> {{ resource.main_resource_category }}
</div>
<div class="px-2">
<span class="fw-bold">Age range:</span> {{ resource.age_range }}
@@ -15,6 +15,12 @@
<div class="px-2">
<span class="fw-bold">Resource type:</span> {{ resource.resource_type }}
</div>
+ <div class="px-2">
+ <span class="fw-bold">Number of files:</span> X NUMBER OF FILES
+ </div>
+ </div>
+ <div>
+ <span class="fw-bold">Created:</span> {{ resource.created|date:"D d M Y" }}
</div>
</div>
</div>
@@ -30,15 +36,15 @@
</div>
</div>
</div>
- <div class="row my-4">
- <div class="col bg-white pt-3 border border-success border-opacity-25 rounded">
- <h4>Resource files preview</h4>
- {% for snapshot_filename, snapshot_urls in resource.snapshot_urls.items %}
- <div>{{ snapshot_filename }}</div>
+ {% for snapshot_filename, snapshot_urls in resource.snapshot_urls.items %}
+ <div class="row my-4">
+ <div class="col bg-white pt-3 border border-success border-opacity-25 rounded">
+ <h4>File preview:</h4>
+ <p>{{ snapshot_filename|cut:".pdf" }}</p>
<div>
- <div class="d-flex flex-row justify-content-between">
+ <div class="d-flex flex-row justify-content-center flex-wrap">
{% for snapshot_url in snapshot_urls %}
- <div class="m-2">
+ <div class="m-4">
<img class="img-thumbnail rounded"
src="{{ snapshot_url }}"
alt="{{ snapshot_filename }}" />
@@ -47,18 +53,12 @@
</div>
</div>
</div>
- {% endfor %}
- </div>
+ </div>
+ {% endfor %}
<div class="row my-5">
<div class="col bg-white pt-3 border border-success border-opacity-25 rounded">
- <div>
- <h3>What's included?</h3>
- <div>{{ resource.description }}</div>
- <h3>What's it for?</h3>
- <div>{% lorem %}</div>
- <h3>Resource Details</h3>
- <div>{% lorem %}</div>
- </div>
+ <h3>What's included?</h3>
+ <div>{{ resource.description }}</div>
</div>
</div>
<div class="row">