# Fix: Department Detail Shows No Complaints + Template Field References

## Root Cause
All 2163 complaints have `sent_to_department=False`. The department detail view queries filter by `sent_to_department=True`, so zero complaints/observations/inquiries appear. The import scripts (`import_all_complaints.py`, `import_historical_complaints.py`) explicitly set `sent_to_department=False`, overwriting the backfill migration from May 16.

## Changes

### 1. NEW FILE: `apps/complaints/management/commands/backfill_sent_to_department.py`
Create management command that sets `sent_to_department=True` on:
- `Complaint.objects.filter(department__isnull=False, sent_to_department=False).update(sent_to_department=True, sent_to_department_at=F('created_at'))`
- `Observation.objects.filter(assigned_department__isnull=False, sent_to_department=False).update(sent_to_department=True, sent_to_department_at=F('created_at'))`
- `Inquiry.objects.filter(department__isnull=False, sent_to_department=False).update(sent_to_department=True, sent_to_department_at=F('created_at'))`
- `ComplaintInvolvedDepartment.objects.filter(sent=False, complaint__department__isnull=False).update(sent=True)`

### 2. EDIT: `apps/complaints/management/commands/import_all_complaints.py`
- Change `sent_to_department=False` → `sent_to_department=True`

### 3. EDIT: `apps/complaints/management/commands/import_historical_complaints.py`
- Change `sent_to_department=False` → `sent_to_department=True`

### 4. EDIT: `templates/organizations/orgsection_list.html`
- Remove `point_of_contact` column (Section model no longer has this field)

### 5. EDIT: `templates/organizations/orgsection_form.html`
- Remove `point_of_contact` form field (lines 136-140)

### 6. EDIT: `templates/complaints/government_ticket_form.html`
- Line 295: change `sec.name` → `sec.name_en || sec.name` (API returns `name_en`, not `name`)

### 7. EDIT: `templates/px_sources/source_user_create_complaint.html`
- Line 303: change `sec.name` → `sec.name_en || sec.name`

### 8. RUN: `python manage.py backfill_sent_to_department`
- Expected: 2163 complaints, 3 observations, 2 inquiries updated

### 9. VERIFY: `python manage.py check` + tests

## What was ALREADY fixed in previous session
- `department_detail.html`: `sub_subsections` → `subsections`, removed floor/poc columns, added champion/supervisor/deputy columns
- `orgsection_detail.html`: removed `point_of_contact` from header
- `ui_views.py:2173`: added supervisor/deputy_supervisor to select_related
