Default task sort to due date instead of raw model order

The "Default" option cleared the sort param and fell back to the
model's Meta.ordering (sort_order, -priority, due_date, created_at),
which read as broken/unsorted to users. Default is now due date
(earliest first), matching the existing due_date sort option.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Keith Smith
2026-08-31 16:55:17 -06:00
co-authored by Claude Sonnet 5
parent 289b5f3856
commit a2bc5de205
2 changed files with 2 additions and 3 deletions
+1 -1
View File
@@ -232,7 +232,7 @@ class DashboardView(View):
current_filter = request.GET.get('filter', 'all')
current_tag_id = request.GET.get('tag')
selected_task_id = request.GET.get('selected')
current_sort = request.GET.get('sort', 'default')
current_sort = request.GET.get('sort', 'due_date')
# Base query
tasks = Task.objects.filter(
+1 -2
View File
@@ -9,7 +9,6 @@
<div style="display: flex; align-items: center; gap: var(--space-md);">
<span class="task-count">{{ tasks|length }} task{{ tasks|length|pluralize }}</span>
<select id="sort-select" onchange="updateSort()" style="padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--surface); color: var(--text);">
<option value="default" {% if current_sort == 'default' %}selected{% endif %}>Default</option>
<option value="due_date" {% if current_sort == 'due_date' %}selected{% endif %}>Due Date (Earliest)</option>
<option value="due_date_desc" {% if current_sort == 'due_date_desc' %}selected{% endif %}>Due Date (Latest)</option>
<option value="priority" {% if current_sort == 'priority' %}selected{% endif %}>Priority (High to Low)</option>
@@ -76,7 +75,7 @@ if (timerDisplay) {
function updateSort() {
const sortValue = document.getElementById('sort-select').value;
const url = new URL(window.location.href);
if (sortValue === 'default') {
if (sortValue === 'due_date') {
url.searchParams.delete('sort');
} else {
url.searchParams.set('sort', sortValue);