Skip to content

refactor: reorganize templates into subdirectories#44

Merged
PascalRepond merged 1 commit intomainfrom
rep-dev
Jan 6, 2026
Merged

refactor: reorganize templates into subdirectories#44
PascalRepond merged 1 commit intomainfrom
rep-dev

Conversation

@PascalRepond
Copy link
Copy Markdown
Owner

  • Enhance template directories structure for better organization.
  • Remove useless tests.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 6, 2026

📝 Walkthrough

Walkthrough

Reorganizes template layout: moves main templates under base/, nests partials into semantic directories (e.g., media_items/, contributors/, navigation/, common/), updates Python view/template-tag template lookup paths, and removes a now-unused partial; a few tests were adjusted/removed to match new paths/behavior.

Changes

Cohort / File(s) Summary
Template path updates in Python
src/core/templatetags/media_tags.py, src/core/views.py
Updated inclusion/render calls to new template locations (e.g., partials/media_items/media_icon.html, base/* views, and HTMX partials under media_items/, contributors/, navigation/).
Base templates & layout
src/templates/base/base.html, src/templates/base/backup_manage.html, src/templates/base/media_detail.html, src/templates/base/media_edit.html, src/templates/base/media_index.html
Changed {% extends %} to base/base.html where applicable; replaced sidebar, navigation, confirm modal, filters and other includes to new paths (partials/navigation/..., partials/common/..., partials/media_items/...).
Account & auth templates
src/templates/accounts/profile_edit.html, src/templates/registration/login.html
extends updated to base/base.html or base/base_auth.html; partials/field_label.html includes switched to partials/common/field_label.html.
Media item partials
src/templates/partials/media_items/media_item.html, src/templates/partials/media_items/media_list.html, src/templates/partials/media_items/media_list_page.html, src/templates/partials/media_items/media_icon.html
Consolidated media-related includes under partials/media_items/...; added i18n and composed media_list_page.html to include media_item.html and load_more_trigger.html.
Score partials
src/templates/partials/media_items/score/media_score_stars.html, src/templates/partials/media_items/score/media_score_stars_inner.html, src/templates/partials/media_items/score/media_score_badge.html
Moved score/star/badge includes to partials/media_items/score/... and adjusted inner include paths and minor markup wrapping.
Common partials
src/templates/partials/common/load_more_trigger.html, src/templates/partials/common/spinner.html, src/templates/partials/common/confirm_modal.html
Updated include paths to partials/common/... (spinner and confirm modal standardized with underscores).
Removed / emptied partial
src/templates/partials/media-items-page.html
Removed i18n load and sub-include logic (functionality moved into media_list_page.html).
Tests updated/removed
src/tests/accounts/test_views.py, src/tests/core/test_views.py
Removed several account validation tests; updated assertions expecting new template paths for views/HTMX partials.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~30 minutes

Possibly related PRs

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The PR title accurately summarizes the main change: reorganizing templates into subdirectories, which is reflected throughout the changeset with consistent path updates from flat to nested directory structures.
Description check ✅ Passed The description is related to the changeset, mentioning template directory structure enhancement and removal of useless tests, both of which are present in the changes.
Docstring Coverage ✅ Passed Docstring coverage is 88.89% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/templates/partials/media_items/score/media_score_stars_inner.html (1)

14-18: Question: Is the extra wrapper div necessary?

The badge include is now wrapped in <div class="flex items-center gap-2">, but:

  • The outer container (line 3) already has flex items-center {{ gap_size }}
  • The inner div only contains a single include, so gap-2 has no effect
  • This creates nested flex containers that may be unnecessary

Was this wrapper added to prepare for future elements, or could it be simplified?

🔎 Proposed simplification

If the wrapper isn't needed for future additions:

  {# Score badge with label (optional) #}
  {% if show_badge != False %}
-    <div class="flex items-center gap-2">
-      {% include "partials/media_items/score/media_score_badge.html" with size=badge_size %}
-    </div>
+    {% include "partials/media_items/score/media_score_badge.html" with size=badge_size %}
  {% endif %}
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bc0bd4b and 9db4589.

📒 Files selected for processing (35)
  • src/core/templatetags/media_tags.py
  • src/core/views.py
  • src/templates/accounts/profile_edit.html
  • src/templates/base/backup_manage.html
  • src/templates/base/base.html
  • src/templates/base/base_auth.html
  • src/templates/base/media_detail.html
  • src/templates/base/media_edit.html
  • src/templates/base/media_index.html
  • src/templates/partials/common/confirm_modal.html
  • src/templates/partials/common/field_label.html
  • src/templates/partials/common/load_more_trigger.html
  • src/templates/partials/common/spinner.html
  • src/templates/partials/contributors/contributor_chip.html
  • src/templates/partials/contributors/contributors_suggestions.html
  • src/templates/partials/media-items-page.html
  • src/templates/partials/media_items/media_contributors.html
  • src/templates/partials/media_items/media_cover.html
  • src/templates/partials/media_items/media_edit_button.html
  • src/templates/partials/media_items/media_icon.html
  • src/templates/partials/media_items/media_item.html
  • src/templates/partials/media_items/media_list.html
  • src/templates/partials/media_items/media_list_page.html
  • src/templates/partials/media_items/media_review_clamped.html
  • src/templates/partials/media_items/media_review_full.html
  • src/templates/partials/media_items/media_status_badge.html
  • src/templates/partials/media_items/score/media_score_badge.html
  • src/templates/partials/media_items/score/media_score_stars.html
  • src/templates/partials/media_items/score/media_score_stars_inner.html
  • src/templates/partials/navigation/filters_drawer.html
  • src/templates/partials/navigation/sidebar_nav.html
  • src/templates/partials/navigation/view_mode_toggle.html
  • src/templates/registration/login.html
  • src/tests/accounts/test_views.py
  • src/tests/core/test_views.py
💤 Files with no reviewable changes (2)
  • src/templates/partials/media-items-page.html
  • src/tests/accounts/test_views.py
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-12-26T15:18:46.932Z
Learnt from: PascalRepond
Repo: PascalRepond/datakult PR: 21
File: src/templates/accounts/profile_edit.html:23-58
Timestamp: 2025-12-26T15:18:46.932Z
Learning: In Django projects, attributes added to a form field's widget via field.widget.attrs.update(...) in the form's __init__ are rendered when using {{ form.field }} in templates. No explicit attribute definitions are needed in the template. This applies to templates under src/templates in Django apps; ensure you update attrs in __init__ for consistent HTMX behavior.

Applied to files:

  • src/templates/registration/login.html
  • src/templates/partials/media_items/media_list.html
  • src/templates/accounts/profile_edit.html
  • src/templates/partials/media_items/media_list_page.html
  • src/templates/partials/common/load_more_trigger.html
  • src/templates/base/media_index.html
  • src/templates/base/media_edit.html
  • src/templates/partials/media_items/media_item.html
  • src/templates/base/base.html
  • src/templates/base/backup_manage.html
  • src/templates/partials/media_items/score/media_score_stars_inner.html
  • src/templates/partials/media_items/score/media_score_stars.html
  • src/templates/base/media_detail.html
📚 Learning: 2026-01-03T21:16:52.649Z
Learnt from: PascalRepond
Repo: PascalRepond/datakult PR: 36
File: src/templates/partials/media-items.html:67-67
Timestamp: 2026-01-03T21:16:52.649Z
Learning: In HTML templates (e.g., src/templates/partials/media-items.html), Tailwind CSS v4.1.11 supports arbitrary numeric utilities (max-w-{n}, w-{n}, h-{n}) that map to calc(var(--spacing) * n). These should be considered valid Tailwind classes and not flagged as invalid. Ensure review tooling and linters treat such numeric utilities as allowed, and apply this guidance to other HTML/template files in the repository.

Applied to files:

  • src/templates/registration/login.html
  • src/templates/partials/media_items/media_list.html
  • src/templates/accounts/profile_edit.html
  • src/templates/partials/media_items/media_list_page.html
  • src/templates/partials/common/load_more_trigger.html
  • src/templates/base/media_index.html
  • src/templates/base/media_edit.html
  • src/templates/partials/media_items/media_item.html
  • src/templates/base/base.html
  • src/templates/base/backup_manage.html
  • src/templates/partials/media_items/score/media_score_stars_inner.html
  • src/templates/partials/media_items/score/media_score_stars.html
  • src/templates/base/media_detail.html
📚 Learning: 2026-01-04T08:55:43.091Z
Learnt from: PascalRepond
Repo: PascalRepond/datakult PR: 36
File: src/templates/partials/media-score-badge.html:1-9
Timestamp: 2026-01-04T08:55:43.091Z
Learning: In Django projects, configuring heroicons in TEMPLATES builtins makes heroicons.templatetags.heroicons available in all templates without needing {% load heroicons %}. For template reviews in this codebase, assume heroicon tags work globally in HTML templates under templates/, so avoid requiring explicit loads. If a template still uses {% load heroicons %}, assess whether the load is unnecessary and can be removed; ensure no conflicts arise from global tags.

Applied to files:

  • src/templates/registration/login.html
  • src/templates/partials/media_items/media_list.html
  • src/templates/accounts/profile_edit.html
  • src/templates/partials/media_items/media_list_page.html
  • src/templates/partials/common/load_more_trigger.html
  • src/templates/base/media_index.html
  • src/templates/base/media_edit.html
  • src/templates/partials/media_items/media_item.html
  • src/templates/base/base.html
  • src/templates/base/backup_manage.html
  • src/templates/partials/media_items/score/media_score_stars_inner.html
  • src/templates/partials/media_items/score/media_score_stars.html
  • src/templates/base/media_detail.html
📚 Learning: 2025-12-27T18:00:03.595Z
Learnt from: PascalRepond
Repo: PascalRepond/datakult PR: 23
File: src/templates/partials/score-readonly.html:2-33
Timestamp: 2025-12-27T18:00:03.595Z
Learning: In src/templates/partials/score-readonly.html, the DaisyUI read-only rating pattern correctly uses `aria-current="true"` on the selected star and applies the same color class (bg-orange-400) to all star elements. DaisyUI's CSS automatically handles which stars are visually filled based on the aria-current position.

Applied to files:

  • src/templates/partials/media_items/score/media_score_stars_inner.html
  • src/templates/partials/media_items/score/media_score_stars.html
  • src/templates/base/media_detail.html
🧬 Code graph analysis (1)
src/core/views.py (2)
src/tests/conftest.py (2)
  • media (20-31)
  • agent (12-16)
src/core/models.py (2)
  • Media (109-227)
  • Agent (95-106)
🔇 Additional comments (18)
src/core/templatetags/media_tags.py (1)

34-34: Template migration is complete and correct.

The template file exists at the new location (src/templates/partials/media_items/media_icon.html), and there are no stale references to the old path in the codebase. The refactoring aligns with the PR's organization goals and is ready to merge.

src/templates/base/backup_manage.html (2)

1-1: LGTM! Base template path updated correctly.

The extends directive now references base/base.html, aligning with the reorganization of base templates into the base/ subdirectory.


157-157: Include path correctly updated to the new location.

The confirm modal template exists at src/templates/partials/common/confirm_modal.html, and all include statements in the codebase reference this correct path with the snake_case naming convention.

src/templates/base/base.html (1)

67-67: LGTM! Sidebar navigation path updated correctly.

The include path now correctly references partials/navigation/sidebar_nav.html, reflecting both the updated directory structure and the consistent naming convention change from kebab-case to snake_case.

src/templates/partials/media_items/media_list_page.html (1)

1-4: LGTM! Template reorganization looks correct.

The path updates align with the broader refactoring to organize templates into subdirectories. The structure is clean and the includes reference the new locations appropriately. The {% load i18n %} is necessary for the included media_item.html template which uses translations.

src/templates/partials/common/load_more_trigger.html (1)

11-11: Spinner paths correctly updated to new location.

Both lines 11 and 19 properly reference partials/common/spinner.html and the template exists at the new location.

src/templates/base/media_index.html (1)

1-1: LGTM! Template reorganization enhances maintainability.

The refactored paths follow a clear semantic structure:

  • Base templates: base/
  • Navigation components: partials/navigation/
  • Media components: partials/media_items/

The naming convention change from kebab-case to snake_case improves consistency. All path references have been updated consistently throughout the codebase.

src/templates/partials/media_items/score/media_score_stars.html (1)

7-7: Template path refactoring is correct.

The include paths correctly reflect the new directory structure, moving score-related templates into media_items/score/. All references to the old path have been updated, and the naming convention change from kebab-case to snake_case aligns with Python conventions.

src/templates/accounts/profile_edit.html (1)

1-1: LGTM! Template paths refactored consistently.

All base and include paths have been updated to reflect the new directory structure. The field_label.html partial is now logically grouped under common/, and all four field label includes have been updated consistently. No remaining references to the old paths exist in the codebase.

src/templates/partials/media_items/media_list.html (1)

7-7: Include paths updated correctly and consistently throughout.

Both occurrences of the template include in lines 7 (grid view) and 23 (table view) have been updated to the new path structure partials/media_items/media_list_page.html. The corresponding view in src/core/views.py and test assertions have also been updated. No remaining references to the old path exist in the codebase.

src/templates/registration/login.html (1)

1-1: LGTM! Base template path updated correctly.

The extends directive now correctly references the relocated base template in the base/ subdirectory. No stale references to the old path remain in the codebase.

src/templates/base/media_detail.html (2)

1-1: LGTM! Template path reorganization is consistent.

The template extends and include paths have been properly updated to reflect the new directory structure (base/ for main templates, partials/media_items/ for media-related partials).

Also applies to: 55-55, 80-80, 84-84


54-56: Verify the extra div wrapper doesn't affect layout.

An additional div with flex flex-wrap gap-1 was added around the contributors include. While this appears intentional for layout consistency, ensure this doesn't introduce unintended spacing or wrapping changes in the UI.

src/tests/core/test_views.py (1)

345-345: LGTM! Test assertions updated correctly.

All template path assertions have been updated to match the new directory structure, ensuring tests remain valid after the reorganization.

Also applies to: 386-386, 435-435, 593-593, 697-697

src/templates/base/media_edit.html (1)

1-1: LGTM! Include paths reorganized effectively.

All include paths have been updated to the new structure:

  • Common components → partials/common/
  • Contributor components → partials/contributors/
  • Base template → base/base.html

This improves code organization and maintainability.

Also applies to: 54-54, 68-68, 77-77, 81-81, 106-106, 117-117, 126-126, 145-145, 155-155, 164-164, 188-188, 219-219

src/templates/partials/media_items/media_item.html (2)

33-33: LGTM! Media item template paths updated consistently.

All include paths have been updated to reference the new partials/media_items/ structure with proper subdirectories for score-related components. The naming convention has been standardized to use underscores.

Also applies to: 35-35, 37-37, 40-42, 46-46, 58-58, 72-72, 76-76, 84-87, 91-91, 96-96, 106-106


39-42: Score display structure improved with wrapper divs.

The score stars are now wrapped in divs with margin classes (mt-2, mb-2) and responsive display logic. This improves layout consistency and spacing control across different view modes.

Also applies to: 84-87

src/core/views.py (1)

23-23: LGTM! View template references updated correctly.

All template paths in view render calls have been updated to match the new directory structure:

  • Main templates → base/ prefix
  • Media-related partials → partials/media_items/
  • Contributor partials → partials/contributors/

The changes are consistent throughout the file.

Also applies to: 31-31, 70-70, 91-91, 98-98, 107-107, 109-111, 118-118, 125-125, 191-191

- Enhance template directories structure for better organization.
- Remove useless tests.

Co-Authored-by: Pascal Repond <pascal.repond@rero.ch>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI Agents
In @src/core/views.py:
- Line 23: Views are referencing new template paths (e.g. the render call using
"base/media_index.html" in functions that render media index/detail/edit and
backup_manage, plus partials like "partials/media_items/media_list_page.html"
and contributor partials) but those files are missing causing
TemplateDoesNotExist; fix by either adding the missing template files at
src/core/templates/base/ and src/core/templates/partials/... with the expected
block structure and names used by the view functions (create media_index.html,
media_detail.html, media_edit.html, backup_manage.html and the listed partials)
or revert each view's render() template argument back to the previous existing
template names (locate calls to render(request, "...") in the view functions
that reference the new paths and update them accordingly) so runtime template
lookups succeed.
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9db4589 and d9a0e80.

📒 Files selected for processing (35)
  • src/core/templatetags/media_tags.py
  • src/core/views.py
  • src/templates/accounts/profile_edit.html
  • src/templates/base/backup_manage.html
  • src/templates/base/base.html
  • src/templates/base/base_auth.html
  • src/templates/base/media_detail.html
  • src/templates/base/media_edit.html
  • src/templates/base/media_index.html
  • src/templates/partials/common/confirm_modal.html
  • src/templates/partials/common/field_label.html
  • src/templates/partials/common/load_more_trigger.html
  • src/templates/partials/common/spinner.html
  • src/templates/partials/contributors/contributor_chip.html
  • src/templates/partials/contributors/contributors_suggestions.html
  • src/templates/partials/media-items-page.html
  • src/templates/partials/media_items/media_contributors.html
  • src/templates/partials/media_items/media_cover.html
  • src/templates/partials/media_items/media_edit_button.html
  • src/templates/partials/media_items/media_icon.html
  • src/templates/partials/media_items/media_item.html
  • src/templates/partials/media_items/media_list.html
  • src/templates/partials/media_items/media_list_page.html
  • src/templates/partials/media_items/media_review_clamped.html
  • src/templates/partials/media_items/media_review_full.html
  • src/templates/partials/media_items/media_status_badge.html
  • src/templates/partials/media_items/score/media_score_badge.html
  • src/templates/partials/media_items/score/media_score_stars.html
  • src/templates/partials/media_items/score/media_score_stars_inner.html
  • src/templates/partials/navigation/filters_drawer.html
  • src/templates/partials/navigation/sidebar_nav.html
  • src/templates/partials/navigation/view_mode_toggle.html
  • src/templates/registration/login.html
  • src/tests/accounts/test_views.py
  • src/tests/core/test_views.py
💤 Files with no reviewable changes (2)
  • src/templates/partials/media-items-page.html
  • src/tests/accounts/test_views.py
✅ Files skipped from review due to trivial changes (1)
  • src/templates/partials/media_items/media_list.html
🚧 Files skipped from review as they are similar to previous changes (8)
  • src/templates/partials/common/load_more_trigger.html
  • src/templates/registration/login.html
  • src/templates/base/base.html
  • src/templates/partials/media_items/score/media_score_stars.html
  • src/templates/base/media_detail.html
  • src/templates/partials/media_items/media_item.html
  • src/templates/partials/media_items/media_list_page.html
  • src/templates/base/backup_manage.html
🧰 Additional context used
🧠 Learnings (4)
📚 Learning: 2025-12-26T15:18:46.932Z
Learnt from: PascalRepond
Repo: PascalRepond/datakult PR: 21
File: src/templates/accounts/profile_edit.html:23-58
Timestamp: 2025-12-26T15:18:46.932Z
Learning: In Django projects, attributes added to a form field's widget via field.widget.attrs.update(...) in the form's __init__ are rendered when using {{ form.field }} in templates. No explicit attribute definitions are needed in the template. This applies to templates under src/templates in Django apps; ensure you update attrs in __init__ for consistent HTMX behavior.

Applied to files:

  • src/templates/accounts/profile_edit.html
  • src/templates/base/media_edit.html
  • src/templates/partials/media_items/score/media_score_stars_inner.html
  • src/templates/base/media_index.html
📚 Learning: 2026-01-03T21:16:52.649Z
Learnt from: PascalRepond
Repo: PascalRepond/datakult PR: 36
File: src/templates/partials/media-items.html:67-67
Timestamp: 2026-01-03T21:16:52.649Z
Learning: In HTML templates (e.g., src/templates/partials/media-items.html), Tailwind CSS v4.1.11 supports arbitrary numeric utilities (max-w-{n}, w-{n}, h-{n}) that map to calc(var(--spacing) * n). These should be considered valid Tailwind classes and not flagged as invalid. Ensure review tooling and linters treat such numeric utilities as allowed, and apply this guidance to other HTML/template files in the repository.

Applied to files:

  • src/templates/accounts/profile_edit.html
  • src/templates/base/media_edit.html
  • src/templates/partials/media_items/score/media_score_stars_inner.html
  • src/templates/base/media_index.html
📚 Learning: 2026-01-04T08:55:43.091Z
Learnt from: PascalRepond
Repo: PascalRepond/datakult PR: 36
File: src/templates/partials/media-score-badge.html:1-9
Timestamp: 2026-01-04T08:55:43.091Z
Learning: In Django projects, configuring heroicons in TEMPLATES builtins makes heroicons.templatetags.heroicons available in all templates without needing {% load heroicons %}. For template reviews in this codebase, assume heroicon tags work globally in HTML templates under templates/, so avoid requiring explicit loads. If a template still uses {% load heroicons %}, assess whether the load is unnecessary and can be removed; ensure no conflicts arise from global tags.

Applied to files:

  • src/templates/accounts/profile_edit.html
  • src/templates/base/media_edit.html
  • src/templates/partials/media_items/score/media_score_stars_inner.html
  • src/templates/base/media_index.html
📚 Learning: 2025-12-27T18:00:03.595Z
Learnt from: PascalRepond
Repo: PascalRepond/datakult PR: 23
File: src/templates/partials/score-readonly.html:2-33
Timestamp: 2025-12-27T18:00:03.595Z
Learning: In src/templates/partials/score-readonly.html, the DaisyUI read-only rating pattern correctly uses `aria-current="true"` on the selected star and applies the same color class (bg-orange-400) to all star elements. DaisyUI's CSS automatically handles which stars are visually filled based on the aria-current position.

Applied to files:

  • src/templates/partials/media_items/score/media_score_stars_inner.html
🔇 Additional comments (17)
src/templates/partials/media_items/score/media_score_stars_inner.html (2)

1-13: LGTM!

The star rating implementation is correct, with proper accessibility attributes (role="img", aria-label, aria-current) that align with the DaisyUI read-only rating pattern. The loop logic correctly applies aria-current="true" to filled stars based on the score.


14-16: The include path update is correct. The target template exists at the new location, confirming the reorganization is properly implemented.

src/templates/base/media_index.html (2)

1-1: LGTM - Base template path updated.

The extends directive correctly references the new base template location at base/base.html.


56-56: LGTM - Include paths updated to new structure.

All template includes have been correctly updated to reference the new organized subdirectories (navigation/ and media_items/). Verification confirms all referenced templates exist and no old-style references remain.

src/templates/accounts/profile_edit.html (2)

1-1: LGTM - Base template path updated.

The extends directive correctly references the new base template location.


25-25: LGTM - Field label includes consistently updated.

All four field label includes have been correctly updated to reference the new common subdirectory path. The changes are consistent across all form fields (lines 25, 36, 47, 58).

src/templates/base/media_edit.html (4)

1-1: LGTM - Base template path updated.

The extends directive correctly references the new base template location.


54-54: LGTM - Field label includes consistently updated across all form fields.

All ten field label includes have been correctly updated to reference the common subdirectory. The changes are consistent across cover, title, contributors, media_type, pub_year, external_uri, score, status, review_date, and review fields.

Also applies to: 68-68, 77-77, 106-106, 117-117, 126-126, 145-145, 155-155, 164-164, 188-188


81-81: LGTM - Contributor chip include updated.

The contributor chip template path has been correctly updated to partials/contributors/contributor_chip.html, organizing contributor-related templates into their own subdirectory and adopting snake_case naming.


219-219: LGTM - Confirm modal include updated.

The confirm modal template path has been correctly updated to partials/common/confirm_modal.html, moving shared UI components to the common subdirectory. All template migrations are complete: new templates exist in their correct locations, old template files have been removed, and no references to old template paths remain in the codebase.

src/tests/core/test_views.py (4)

345-345: LGTM - HTMX media review template assertions updated.

The test assertions have been correctly updated to expect the new template paths under partials/media_items/ for both clamped and full review partials.

Also applies to: 386-386


435-435: LGTM - Backup manage template assertion updated.

The test correctly expects the backup management template at the new base/backup_manage.html path.


593-593: LGTM - Load more media template assertion updated.

The test correctly expects the media list page partial at the new partials/media_items/media_list_page.html path.


697-697: LGTM - Media detail template assertion updated.

The test correctly expects the media detail template at the new base/media_detail.html path. Template file and view implementation both use the updated path consistently with no legacy references remaining.

src/core/templatetags/media_tags.py (1)

34-34: LGTM - Template path correctly updated to match new structure.

The template has been successfully migrated to partials/media_items/media_icon.html, the old path has been removed, and there are no lingering references to the previous location.

src/core/views.py (2)

23-23: LGTM! Base template paths updated consistently.

The migration of main templates to the base/ subdirectory follows a clean organizational pattern and improves template discoverability.

Also applies to: 31-31, 70-70, 191-191


91-91: LGTM! HTMX partial paths organized into semantic subdirectories.

The reorganization into partials/media_items/ and partials/contributors/ provides better logical grouping, and the shift to snake_case naming aligns well with Python conventions.

Also applies to: 98-98, 107-107, 109-111, 118-118, 125-125

Comment thread src/core/views.py
"""Main view for displaying media list."""
context = build_media_context(request)
return render(request, "media.html", context)
return render(request, "base/media_index.html", context)
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Jan 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

echo "=== Checking if new template files exist ==="
new_templates=(
  "src/core/templates/base/media_index.html"
  "src/core/templates/base/media_detail.html"
  "src/core/templates/base/media_edit.html"
  "src/core/templates/base/backup_manage.html"
  "src/core/templates/partials/media_items/media_list_page.html"
  "src/core/templates/partials/contributors/contributors_suggestions.html"
  "src/core/templates/partials/contributors/contributor_chip.html"
  "src/core/templates/partials/media_items/media_review_clamped.html"
  "src/core/templates/partials/media_items/media_review_full.html"
)

missing_count=0
for template in "${new_templates[@]}"; do
  if [ ! -f "$template" ]; then
    echo "❌ MISSING: $template"
    ((missing_count++))
  else
    echo "✅ EXISTS: $template"
  fi
done

if [ $missing_count -eq 0 ]; then
  echo -e "\n✅ All new templates exist"
else
  echo -e "\n❌ $missing_count template(s) missing"
fi

echo -e "\n=== Checking for references to old template paths ==="
old_paths=(
  'media\.html'
  'media_detail\.html'
  'media_edit\.html'
  'backup_manage\.html'
  'partials/media-items-page\.html'
  'partials/contributors-suggestions\.html'
  'partials/contributor-chip\.html'
  'partials/media-review-clamped\.html'
  'partials/media-review-full\.html'
)

found_old_refs=0
for old_path in "${old_paths[@]}"; do
  matches=$(rg "$old_path" --type py --type html 2>/dev/null | grep -v "src/core/views.py" || true)
  if [ -n "$matches" ]; then
    echo "⚠️  Found references to old path pattern '$old_path':"
    echo "$matches" | head -10
    ((found_old_refs++))
  fi
done

if [ $found_old_refs -eq 0 ]; then
  echo "✅ No stale references to old template paths found"
else
  echo -e "\n⚠️  Found references to $found_old_refs old path pattern(s)"
fi

Repository: PascalRepond/datakult

Length of output: 1171


All new template files are missing. The views have been updated to reference new template paths, but the actual template files do not exist:

  • src/core/templates/base/media_index.html
  • src/core/templates/base/media_detail.html
  • src/core/templates/base/media_edit.html
  • src/core/templates/base/backup_manage.html
  • src/core/templates/partials/media_items/media_list_page.html
  • src/core/templates/partials/contributors/contributors_suggestions.html
  • src/core/templates/partials/contributors/contributor_chip.html
  • src/core/templates/partials/media_items/media_review_clamped.html
  • src/core/templates/partials/media_items/media_review_full.html

These changes will cause TemplateDoesNotExist exceptions at runtime. Either create the template files at these locations or revert the template path references.

🤖 Prompt for AI Agents
In @src/core/views.py at line 23, Views are referencing new template paths (e.g.
the render call using "base/media_index.html" in functions that render media
index/detail/edit and backup_manage, plus partials like
"partials/media_items/media_list_page.html" and contributor partials) but those
files are missing causing TemplateDoesNotExist; fix by either adding the missing
template files at src/core/templates/base/ and src/core/templates/partials/...
with the expected block structure and names used by the view functions (create
media_index.html, media_detail.html, media_edit.html, backup_manage.html and the
listed partials) or revert each view's render() template argument back to the
previous existing template names (locate calls to render(request, "...") in the
view functions that reference the new paths and update them accordingly) so
runtime template lookups succeed.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those files are in src/templates/...

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash

echo "=== Checking if template files exist in src/templates/ ==="
templates=(
  "src/templates/base/media_index.html"
  "src/templates/base/media_detail.html"
  "src/templates/base/media_edit.html"
  "src/templates/base/backup_manage.html"
  "src/templates/partials/media_items/media_list_page.html"
  "src/templates/partials/contributors/contributors_suggestions.html"
  "src/templates/partials/contributors/contributor_chip.html"
  "src/templates/partials/media_items/media_review_clamped.html"
  "src/templates/partials/media_items/media_review_full.html"
)

missing_count=0
for template in "${templates[@]}"; do
  if [ ! -f "$template" ]; then
    echo "❌ MISSING: $template"
    ((missing_count++))
  else
    echo "✅ EXISTS: $template"
  fi
done

if [ $missing_count -eq 0 ]; then
  echo -e "\n✅ All templates exist in src/templates/"
else
  echo -e "\n⚠️ $missing_count template(s) still missing"
fi

Length of output: 634


@PascalRepond, you're absolutely right! I apologize for the incorrect analysis. All the template files exist in src/templates/:

src/templates/base/media_index.html
src/templates/base/media_detail.html
src/templates/base/media_edit.html
src/templates/base/backup_manage.html
src/templates/partials/media_items/media_list_page.html
src/templates/partials/contributors/contributors_suggestions.html
src/templates/partials/contributors/contributor_chip.html
src/templates/partials/media_items/media_review_clamped.html
src/templates/partials/media_items/media_review_full.html

The template reorganization is correctly implemented. Django's template loader will find these files in the configured template directory.


✏️ Learnings added
Learnt from: PascalRepond
Repo: PascalRepond/datakult PR: 44
File: src/core/views.py:23-23
Timestamp: 2026-01-06T15:18:30.011Z
Learning: In the datakult repository, Django templates are located in `src/templates/`, not `src/core/templates/`. The Django TEMPLATES setting is configured to load templates from this directory.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

@PascalRepond PascalRepond merged commit bc1a6ea into main Jan 6, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant