Compare commits

...

1 Commits

Author SHA1 Message Date
giles
9cba422aa9 Fix DTO compatibility: replace ORM relationship traversals with DTO fields
Templates were accessing entry.calendar.name/slug/post via ORM relationships,
but these entries are now CalendarEntryDTOs. Use flat fields instead
(calendar_name, calendar_slug, etc.).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-19 05:04:53 +00:00
5 changed files with 10 additions and 6 deletions

View File

@@ -76,7 +76,7 @@
<div class="overflow-x-auto scrollbar-hide" style="scroll-behavior: smooth;">
<div class="flex gap-2 px-2">
{% for entry in post.associated_entries %}
{% set _entry_path = '/' + post.slug + '/calendars/' + entry.calendar.slug + '/' + entry.start_at.year|string + '/' + entry.start_at.month|string + '/' + entry.start_at.day|string + '/entries/' + entry.id|string + '/' %}
{% set _entry_path = '/' + post.slug + '/calendars/' + entry.calendar_slug + '/' + entry.start_at.year|string + '/' + entry.start_at.month|string + '/' + entry.start_at.day|string + '/entries/' + entry.id|string + '/' %}
<a
href="{{ events_url(_entry_path) }}"
class="flex flex-col gap-1 px-3 py-2 bg-stone-50 hover:bg-stone-100 rounded border border-stone-200 transition text-sm whitespace-nowrap flex-shrink-0 min-w-[180px]">

View File

@@ -43,7 +43,7 @@
<li class="flex items-start justify-between text-sm">
<div>
<div class="font-medium">
{{ entry.name or entry.calendar.name }}
{{ entry.name or entry.calendar_name }}
</div>
<div class="text-xs text-stone-500">
{{ entry.start_at }}

View File

@@ -4,14 +4,14 @@
{% set has_more_entries = has_more if has_more is defined else (associated_entries.has_more if associated_entries is defined else False) %}
{% for entry in entry_list %}
{% set _entry_path = '/' + post.slug + '/calendars/' + entry.calendar.slug + '/' + entry.start_at.year|string + '/' + entry.start_at.month|string + '/' + entry.start_at.day|string + '/entries/' + entry.id|string + '/' %}
{% set _entry_path = '/' + post.slug + '/calendars/' + entry.calendar_slug + '/' + entry.start_at.year|string + '/' + entry.start_at.month|string + '/' + entry.start_at.day|string + '/entries/' + entry.id|string + '/' %}
<a
href="{{ events_url(_entry_path) }}"
class="{{styles.nav_button_less_pad}}"
>
{% if entry.calendar.post.feature_image %}
<img src="{{ entry.calendar.post.feature_image }}"
alt="{{ entry.calendar.post.title }}"
{% if post.feature_image %}
<img src="{{ post.feature_image }}"
alt="{{ post.title }}"
class="w-8 h-8 rounded object-cover flex-shrink-0" />
{% else %}
<div class="w-8 h-8 rounded bg-stone-200 flex-shrink-0"></div>

View File

@@ -60,6 +60,8 @@ class CalendarEntryDTO:
ticket_count: int | None = None
calendar_name: str | None = None
calendar_slug: str | None = None
calendar_container_id: int | None = None
calendar_container_type: str | None = None
# ---------------------------------------------------------------------------

View File

@@ -42,6 +42,8 @@ def _entry_to_dto(entry: CalendarEntry) -> CalendarEntryDTO:
ticket_count=entry.ticket_count,
calendar_name=cal.name if cal else None,
calendar_slug=cal.slug if cal else None,
calendar_container_id=cal.container_id if cal else None,
calendar_container_type=cal.container_type if cal else None,
)