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") sequence = ("view", "stem", "answers")#, "exams")
attrs = {"class": "table row-selector"} attrs = {"class": "table row-selector"}
order_by = "-created_date"
def __init__(self, data=None, *args, **kwargs): def __init__(self, data=None, *args, **kwargs):
super().__init__( super().__init__(
@@ -32,19 +32,20 @@
{% endif %} {% endif %}
</ul> </ul>
</p> <p><strong>Best Answer:</strong> {{ item.payload.best_answer|default:'' }}
<p><strong>Feedback:</strong> {{ item.payload.feedback|default:''|safe }}</p> </p>
<p><strong>Sources:</strong> <p><strong>Feedback:</strong> {{ item.payload.feedback|default:''|safe }}</p>
{% if item.payload.sources %} <p><strong>Sources:</strong>
<ul> {% if item.payload.sources %}
{% for source in item.payload.sources %} <ul>
<li>{{ source }}</li> {% for source in item.payload.sources %}
{% endfor %} <li>{{ source }}</li>
</ul> {% endfor %}
{% else %} </ul>
None {% else %}
{% endif %} None
</p> {% endif %}
</p>
{% endif %} {% endif %}
<p><strong>M2M fields (click to exclude)</strong></p> <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> <p class="small text-muted">Green = will be created/attached. Click a value to exclude it (grey).</p>
@@ -141,23 +142,23 @@
</div> </div>
<! -- Category --> <! -- Category -->
<div class="m2m-group" data-model="Category"><strong>Category:</strong> <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 --> <!-- DEBUG: show raw resolved and missing maps for troubleshooting -->
<div class="card-footer text-monospace small"> <div class="card-footer text-monospace small">
<details> <details>
<summary>Debug: resolved_m2m / missing_map (click to expand)</summary> <summary>Debug: resolved_m2m / missing_map (click to expand)</summary>
<pre style="white-space:pre-wrap;">resolved_m2m: {{ item.resolved_m2m|default:"{}" }} <pre style="white-space:pre-wrap;">resolved_m2m: {{ item.resolved_m2m|default:"{}" }}
missing_map: {{ item.missing_map|default:"{}" }}</pre> missing_map: {{ item.missing_map|default:"{}" }}</pre>
</details> </details>
</div> </div>
<div> <div>
<label><input type="checkbox" name="selected" value="{{ item.index }}" checked> Include</label> <label><input type="checkbox" name="selected" value="{{ item.index }}" checked> Include</label>
</div> </div>
<!-- container for hidden exclude inputs for this item --> <!-- container for hidden exclude inputs for this item -->
<div id="exclude-container-{{ item.index }}"></div> <div id="exclude-container-{{ item.index }}"></div>
</div> </div>
</div> </div>
{% endfor %} {% endfor %}