From 032a1d5c74b63d2500acc8597d810c987716151f Mon Sep 17 00:00:00 2001 From: Shreyansh Mojidra Date: Mon, 2 Mar 2026 20:44:02 +0000 Subject: [PATCH 1/4] New: Internal VideoPlayer --- web/templates/videos/list.html | 5 ++- web/templates/videos/video_detail.html | 43 ++++++++++++++++++++++++++ web/urls.py | 1 + web/views.py | 8 +++++ 4 files changed, 54 insertions(+), 3 deletions(-) create mode 100644 web/templates/videos/video_detail.html diff --git a/web/templates/videos/list.html b/web/templates/videos/list.html index 3be0307fa..1c8e7e094 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 - diff --git a/web/templates/videos/video_detail.html b/web/templates/videos/video_detail.html new file mode 100644 index 000000000..e9d174410 --- /dev/null +++ b/web/templates/videos/video_detail.html @@ -0,0 +1,43 @@ +{% 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 %} + {% 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" }} + • {{ video.category.name }} +
+ +
{{ 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..94eb672ae 100644 --- a/web/views.py +++ b/web/views.py @@ -6062,6 +6062,14 @@ def fetch_video_oembed(video_url): return {} +def video_detail(request, id): + video = get_object_or_404(EducationalVideo, id=id) + + related_videos = EducationalVideo.objects.filter(category=video.category).exclude(id=id)[:5] + + return render(request, "videos/video_detail.html", {"video": video, "related_videos": related_videos}) + + def upload_educational_video(request): """ Handles GET → render form, POST → save video. From 9bfa9bc35787ba3fc9dfdf6dad433021a87ef2fa Mon Sep 17 00:00:00 2001 From: Shreyansh Mojidra Date: Tue, 3 Mar 2026 08:04:06 +0000 Subject: [PATCH 2/4] Suggested Fixes --- web/templates/videos/list.html | 3 +-- web/templates/videos/video_detail.html | 1 + web/views.py | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/web/templates/videos/list.html b/web/templates/videos/list.html index 1c8e7e094..e304a7ae4 100644 --- a/web/templates/videos/list.html +++ b/web/templates/videos/list.html @@ -122,8 +122,7 @@

- {{ video.title }}

diff --git a/web/templates/videos/video_detail.html b/web/templates/videos/video_detail.html index e9d174410..b1a46a5cf 100644 --- a/web/templates/videos/video_detail.html +++ b/web/templates/videos/video_detail.html @@ -12,6 +12,7 @@ {% 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 %}
diff --git a/web/views.py b/web/views.py index 9e991fc61..9ff601d95 100644 --- a/web/views.py +++ b/web/views.py @@ -6065,8 +6065,6 @@ def fetch_video_oembed(video_url): def video_detail(request, id): video = get_object_or_404(EducationalVideo, id=id) - # related_videos = EducationalVideo.objects.filter(category=video.category).exclude(id=id)[:5] - return render(request, "videos/video_detail.html", {"video": video}) From b5513d158ee19ef5352dc98c4cffc7de0062c6c2 Mon Sep 17 00:00:00 2001 From: Shreyansh Mojidra Date: Tue, 3 Mar 2026 09:16:36 +0000 Subject: [PATCH 4/4] new suggested fixes --- web/templates/videos/video_detail.html | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/templates/videos/video_detail.html b/web/templates/videos/video_detail.html index 29be4b35c..223cd7ea2 100644 --- a/web/templates/videos/video_detail.html +++ b/web/templates/videos/video_detail.html @@ -28,7 +28,8 @@ {% if video.video_url %} + rel="noopener noreferrer" + class="inline-block bg-teal-300 hover:bg-teal-400 text-white px-6 py-2 rounded-lg transition duration-200"> Open Video in New Tab {% else %} @@ -49,7 +50,7 @@

{{ video.title Uploaded by Anonymous {% endif %} • {{ video.uploaded_at|date:"F j, Y" }} - • {{ video.category.name }} + {% if video.category %}• {{ video.category.name }}{% endif %}

{{ video.description }}