sky form TZ: render-readonly + drop #id_nf_tz_hint; placeholder absorbs the auto-detected hint copy — TDD
All checks were successful
ci/woodpecker/push/pyswiss Pipeline was successful
ci/woodpecker/push/main Pipeline was successful

A user-typed TZ override fed through schedulePreview's `if (tz) params.set('tz', tz)` path made PySwiss compute the chart against a TZ that didn't match the lat/lon, so a partial edit (e.g. "America/New_Yo|") returned HTTP 400. Mirror the lat/lon convention: tz field gets readonly + tabindex:-1 across all three sky contexts (Dashsky sky.html, in-room PICK SKY _sky_overlay.html, My Sky applet _applet-my-sky.html). Auto-population still works because the JS writes via .value rather than via user input. The <small id="id_nf_tz_hint"> "Auto-detected from coordinates." line is removed; that copy now lives on the <input>'s placeholder so an empty TZ field self-explains. JS purges every tzHint reference (const declaration + 4 .textContent writes per file × 3 files).

SkyViewTest.test_tz_input_is_readonly_and_carries_auto_detect_placeholder pins the rendered Dashsky markup: id_nf_tz carries `readonly`, the placeholder is "auto-detected from coordinates", and `id="id_nf_tz_hint"` no longer appears anywhere. Existing MySkyTimezoneRefreshTest still passes — it asserts the field auto-fills via JS, which still works on a readonly input.

Code architected by Disco DeDisco <discodedisco@outlook.com>
Git commit message Co-Authored-By:
Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Disco DeDisco
2026-05-08 15:27:09 -04:00
parent 8a8d1536b1
commit 1111df8465
4 changed files with 24 additions and 21 deletions

View File

@@ -37,6 +37,22 @@ class SkyViewTest(TestCase):
self.assertContains(response, reverse("sky_preview"))
self.assertContains(response, reverse("sky_save"))
def test_tz_input_is_readonly_and_carries_auto_detect_placeholder(self):
"""Manual TZ edits throw the schedulePreview / PySwiss fetch off (the
backend gets a stale TZ for the new lat/lon), so the field is render-
readonly like lat/lon — auto-fills from preview, never from a typed
override. The old <small id="id_nf_tz_hint"> is gone; its copy lives
in the placeholder so an empty field is self-explanatory."""
response = self.client.get(reverse("sky"))
self.assertContains(response, 'id="id_nf_tz"')
# readonly + tabindex:-1 mirrors the lat/lon pattern.
self.assertRegex(
response.content.decode(),
r'id="id_nf_tz"[^>]*\breadonly\b',
)
self.assertContains(response, 'placeholder="auto-detected from coordinates"')
self.assertNotContains(response, 'id="id_nf_tz_hint"')
class SkyPreviewTest(TestCase):
def setUp(self):