diff --git a/web/templates/videos/list.html b/web/templates/videos/list.html index 3be0307fa..e304a7ae4 100644 --- a/web/templates/videos/list.html +++ b/web/templates/videos/list.html @@ -97,8 +97,7 @@

{{ video.title }} thumbnail - @@ -108,7 +107,7 @@

{{ video.title }} thumbnail - @@ -123,8 +122,7 @@

- {{ video.title }}

diff --git a/web/templates/videos/video_detail.html b/web/templates/videos/video_detail.html new file mode 100644 index 000000000..223cd7ea2 --- /dev/null +++ b/web/templates/videos/video_detail.html @@ -0,0 +1,59 @@ +{% extends "base.html" %} + +{% block title %} + {{ video.title }} - Alpha One Labs +{% endblock title %} +{% block content %} +
+
+ +
+ {% if "youtube.com" in video.video_url or "youtu.be" in video.video_url %} + {% with video.video_url|cut:"https://www.youtube.com/watch?v="|cut:"https://youtu.be/" as raw_id %} + {% with raw_id|slice:":11" as video_id %} + + {% endwith %} + {% endwith %} + {% else %} + +
+

Video cannot be played directly.

+ {% if video.video_url %} + + Open Video in New Tab + + {% else %} +

No video URL available.

+ {% endif %} +
+ {% endif %} +
+ +

{{ video.title }}

+ +
+ {% if video.uploader %} + Uploaded by {{ video.uploader.get_full_name|default:video.uploader.username }} + {% elif video.submitter_name %} + Uploaded by {{ video.submitter_name }} + {% else %} + Uploaded by Anonymous + {% endif %} + • {{ video.uploaded_at|date:"F j, Y" }} + {% if video.category %}• {{ video.category.name }}{% endif %} +
+ +
{{ video.description }}
+
+
+{% endblock content %} diff --git a/web/urls.py b/web/urls.py index 3fb4e298a..1ba060b17 100644 --- a/web/urls.py +++ b/web/urls.py @@ -322,6 +322,7 @@ # Educational Videos URLs path("videos/", views.educational_videos_list, name="educational_videos_list"), path("videos/upload/", views.upload_educational_video, name="upload_educational_video"), + path("videos//", views.video_detail, name="video_detail"), path("fetch-video-title/", views.fetch_video_title, name="fetch_video_title"), # Storefront Management path("store/create/", login_required(views.StorefrontCreateView.as_view()), name="storefront_create"), diff --git a/web/views.py b/web/views.py index b4d485749..9ff601d95 100644 --- a/web/views.py +++ b/web/views.py @@ -6062,6 +6062,12 @@ def fetch_video_oembed(video_url): return {} +def video_detail(request, id): + video = get_object_or_404(EducationalVideo, id=id) + + return render(request, "videos/video_detail.html", {"video": video}) + + def upload_educational_video(request): """ Handles GET → render form, POST → save video.