6.0 KiB
1. Task Description
NearBeach is a Django/Vue project management tool that currently has task detail views and task creation, but lacks a general task list view for users to see all their tasks across projects. Users must navigate through individual projects or kanban boards to find tasks, which is inefficient for project managers overseeing multiple projects. This task adds a dedicated /tasks/ page with filtering (status, assignee, project, date range), sortable columns, and pagination.
2. How to Judge Completion
Run the NearBeach setup commands (install, migrate, create superuser, runserver), log in as admin/password, and navigate to /tasks/ — a paginated table of tasks the user has permission to view should appear. Test filtering by status, assignee, project, and date range; verify column headers toggle ascending/descending sort; confirm page size selector (10/25/50/100) and page navigation work. Run python3 manage.py test NearBeach.tests.tests_views.tests_task — 10+ new tests covering filtering, sorting, pagination, and permissions should pass. Create a second user without access to a project, log in as them, and verify they cannot see tasks from that project.
3. Other Notes for Reviewer
NearBeach uses a group-based permission system via ObjectAssignment — users only see tasks from projects their groups are assigned to. The implementation must filter the queryset at the database level (not in templates) following the existing pattern in sprint_list view. Superusers bypass all filters. The task touches Django views, templates, URL routing, forms, and requires comprehensive tests to ensure permission filtering works correctly across all filter/sort/pagination combinations.
Implementation Essentials (for Model)
View & Template:
- Server-rendered Django template (no Vue component):
NearBeach/templates/NearBeach/tasks/task_list.html - URL:
path("tasks/", views.task_list, name="task_list") - Follows
sprint_listpattern for permission filtering viaObjectAssignment→UserGroup→Group - All state (filters, sort, page, page_size) lives in the query string; every link rebuilds it
Filter Sidebar (GET form, action="/tasks/"):
| Param | Control | Query |
|---|---|---|
status (repeatable) |
Checkboxes; value = task_status_id |
task_status_id__in=[...] |
assignee |
Select; value = user id (0 = Unassigned) |
task_assigned_to=<id> / task_assigned_to__isnull=True |
project |
Select; value = project_id |
Tasks linked via ObjectAssignment |
start_date |
<input type="date">, optional |
task_start_date__gte=value |
end_date |
<input type="date">, optional |
task_end_date__lte=value |
- Status options from
ListOfTaskStatusordered bytask_status_sort_order - Assignee options: "All", users with task access in accessible projects, "Unassigned" (0)
- Project options: "All", projects user can reach through their groups
- Clear Filters = link to
/tasks/(drops all params); Apply = form submit - Hidden
sortinput in form carries current sort; hiddenpage_sizedropdown in form
Table (9 columns):
| Column | Sort Field | Rendering |
|---|---|---|
| Title | task_short_description |
Bold description + #T-{task_id} small |
| Status | task_status__task_status_sort_order |
Badge: badge-{{ higher_order_status|lower }} |
| Priority | task_priority |
8px dot + {{ get_task_priority_display }} |
| Assignee | task_assigned_to__username |
Username or - |
| Project | first_project_name (annotated) |
Via ObjectAssignment subquery |
| Start Date | task_start_date |
Y-m-d |
| End Date | task_end_date |
Y-m-d |
| Created | date_created |
Y-m-d (default sort: -date_created) |
| Actions | — | "View" → {% url 'task_information' task.task_id %} |
Status Badges (4 classes by task_higher_order_status):
badge-backlog(New, Backlog) — yellowbadge-normal(In Progress, Test/Review) — bluebadge-blocked(Blocked) — redbadge-closed(Closed) — green
Priority (3 color groups):
priority-high(0=Highest, 1=High) — redpriority-normal(2=Normal) — orangepriority-low(3=Low, 4=Lowest) — blue
Sorting:
?sort=field= ASC (▲),?sort=-field= DESC (▼)- Click active column → toggle; click different column → ASC
- Allowed fields: the 8 above only; invalid falls back to default
- Header links keep all other params, reset
page=1 - Hidden
sortinput in filter form persists current sort
Pagination:
page_size: 10/25/50/100 (default 25); invalid → 25; dropdown in filter form, auto-submitspage:Paginator.get_page()(safe); elided range:on_each_side=2, on_ends=1- Prev/Next: disabled (
<span>) on first/last page - All page links preserve filters, sort, page_size; change only
page - Apply / sort click / page_size change / Clear Filters → reset to
page=1 - Results:
Showing {{ page_obj.start_index }}–{{ page_obj.end_index }} of {{ paginator.count }} tasks
Actions Column: Pinned right (th:last-child, td:last-child { position: sticky; right: 0; }); other columns scroll sideways inside container
Empty State: {% empty %} row with colspan="9", centered "No tasks found"; count shows "0–0 of 0"
Permissions (DB-level, not template):
- Queryset limited to tasks from projects user's groups can reach via
ObjectAssignment - Superusers see all
user_level= max task permission across groups- "+ New Task" button:
user_level >= 3 - "View" button:
user_level >= 1 - Filter sidebar: always visible
Styling:
- New partial:
src/sass/components/_task_list.scss→ imported inmain.scss - Add
--nb-*tokens for new colors in both_light_theme.scssand_dark_theme.scss - Reuse:
btn btn-primary,btn btn-secondary,form-control,badge, card/spacing styles - Layout: desktop = sidebar (~280px) + table; <1024px = stacked
- Table cells: 12px 16px padding
- Badge text + background readable in both themes
Tests: 12 test methods in NearBeach/tests/tests_views/tests_task/test_task_list.py