Add ordering by created date to QuestionTable and update import preview layout for better readability

This commit is contained in:
Ross
2025-10-20 13:53:08 +01:00
parent 5d09c34f6d
commit bc21dd6ebd
2 changed files with 27 additions and 25 deletions
+1
View File
@@ -46,6 +46,7 @@ class QuestionTable(tables.Table):
)
sequence = ("view", "stem", "answers")#, "exams")
attrs = {"class": "table row-selector"}
order_by = "-created_date"
def __init__(self, data=None, *args, **kwargs):
super().__init__(
@@ -32,19 +32,20 @@
{% endif %}
</ul>
</p>
<p><strong>Feedback:</strong> {{ item.payload.feedback|default:''|safe }}</p>
<p><strong>Sources:</strong>
{% if item.payload.sources %}
<ul>
{% for source in item.payload.sources %}
<li>{{ source }}</li>
{% endfor %}
</ul>
{% else %}
None
{% endif %}
</p>
<p><strong>Best Answer:</strong> {{ item.payload.best_answer|default:'' }}
</p>
<p><strong>Feedback:</strong> {{ item.payload.feedback|default:''|safe }}</p>
<p><strong>Sources:</strong>
{% if item.payload.sources %}
<ul>
{% for source in item.payload.sources %}
<li>{{ source }}</li>
{% endfor %}
</ul>
{% else %}
None
{% endif %}
</p>
{% endif %}
<p><strong>M2M fields (click to exclude)</strong></p>
<p class="small text-muted">Green = will be created/attached. Click a value to exclude it (grey).</p>
@@ -141,23 +142,23 @@
</div>
<! -- Category -->
<div class="m2m-group" data-model="Category"><strong>Category:</strong>
{{ item.payload.category|default:'(none)' }}
{{ item.payload.category|default:'(none)' }}
</div>
</div>
<!-- DEBUG: show raw resolved and missing maps for troubleshooting -->
<div class="card-footer text-monospace small">
<details>
<summary>Debug: resolved_m2m / missing_map (click to expand)</summary>
<div class="card-footer text-monospace small">
<details>
<summary>Debug: resolved_m2m / missing_map (click to expand)</summary>
<pre style="white-space:pre-wrap;">resolved_m2m: {{ item.resolved_m2m|default:"{}" }}
missing_map: {{ item.missing_map|default:"{}" }}</pre>
</details>
</div>
<div>
<label><input type="checkbox" name="selected" value="{{ item.index }}" checked> Include</label>
</div>
</details>
</div>
<div>
<label><input type="checkbox" name="selected" value="{{ item.index }}" checked> Include</label>
</div>
<!-- container for hidden exclude inputs for this item -->
<div id="exclude-container-{{ item.index }}"></div>
</div>
<div id="exclude-container-{{ item.index }}"></div>
</div>
</div>
{% endfor %}