Fix: eagerload series.sets i admin og API (MissingGreenlet i async mode)

This commit is contained in:
2026-07-01 22:15:14 +02:00
parent c0952a3bd3
commit 8361066f2f
20 changed files with 1075 additions and 554 deletions
+48 -45
View File
@@ -1,54 +1,57 @@
{% extends "base.html" %}
{% block title %}{{ set.code }} — {{ set.name }}{% endblock %}
{% block content %}
<div style="margin-bottom:20px;">
<a href="/sets" style="color:var(--text-muted);text-decoration:none;font-size:0.9rem;">← Tilbage til serier</a>
</div>
<a href="/series/{{ set.serie.name|urlencode }}" style="color:var(--text-muted);text-decoration:none;font-size:0.9rem;">
&larr; {{ set.serie.name }}
</a>
<div class="card" style="margin-bottom:24px;">
<span class="tag" style="font-size:1rem;">{{ set.code }}</span>
<h1 style="margin-top:8px;">{{ set.name }}</h1>
{% if set.release_date %}
<p style="color:var(--text-muted);">📅 Udgivet: {{ set.release_date }}</p>
{% endif %}
{% if set.description %}
<p style="margin-top:8px;">{{ set.description }}</p>
{% endif %}
<p style="font-size:0.9rem;color:var(--text-muted);margin-top:8px;">{{ set.cards|length }} kort i dette set</p>
</div>
<h1 style="margin-top:12px;">
<span class="tag">{{ set.code }}</span>
{{ set.name }}
</h1>
<h2>Kort i {{ set.code }}</h2>
{% if set.release_date %}
<p style="color:var(--text-muted);margin-bottom:6px;">Udgivet: {{ set.release_date }}</p>
{% endif %}
<p style="font-size:0.85rem;color:var(--text-muted);margin-bottom:20px;">{{ set.cards|length }} kort</p>
{% if set.cards|length > 0 %}
<div style="overflow-x:auto;">
<table>
<thead>
<tr>
<th>#</th>
<th>Kode</th>
<th>Navn</th>
<th>Type</th>
<th>Sjældenhed</th>
{% if set.cards[0].hp %}<th>HP</th>{% endif %}
</tr>
</thead>
<tbody>
{% for card in set.cards %}
<tr>
<td>{{ card.number }}</td>
<td><span class="tag">{{ card.full_code }}</span></td>
<td>{{ card.name }}</td>
<td>{{ card.type or "—" }}</td>
<td>{{ card.rarity or "—" }}</td>
{% if card.hp %}<td>{{ card.hp }}</td>{% endif %}
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<table>
<thead>
<tr>
<th>#</th>
<th>Navn</th>
<th>Kode</th>
<th>Billede</th>
</tr>
</thead>
<tbody>
{% for card in set.cards %}
<tr>
<td style="font-weight:600;">{{ card.number }}</td>
<td>
<a href="/card/{{ set.code }}/{{ card.number }}" style="color:var(--text);text-decoration:none;">
{{ card.name }}
</a>
</td>
<td><span class="tag">{{ card.full_code }}</span></td>
<td>
{% if card.image_url %}
<a href="/card/{{ set.code }}/{{ card.number }}">
<img src="{{ card.image_url }}" alt="{{ card.name }}"
style="height:60px;border-radius:6px;object-fit:contain;">
</a>
{% else %}
<span style="color:var(--text-muted);font-size:0.8rem;">Intet billede</span>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if set.cards|length == 0 %}
<div class="card" style="text-align:center;color:var(--text-muted);">
<p>Ingen kort i dette set endnu.</p>
<p>Ingen kort i dette sæt endnu.</p>
</div>
{% endif %}
{% endblock %}
{% endblock %}