Round out referee amounts/colors, and add bilingual (nl/en) news content

Referee display: drop the redundant "External" pill from the PDF form, round
the event/dashboard "due" summary to 2 decimals (a fine-grained km rate like
0.083 was pushing the raw total to 3+ decimals), and theme the PDF's accent
colors off the club's own primary/secondary colors instead of a hardcoded
default.

News: title/body stay the club's own-language (Dutch) text; new optional
title_en/body_en carry a translation, with News.effective_title_en/
effective_body_en resolving the fallback to the original on read rather than
copying it in at save time -- so editing the Dutch text later never leaves a
stale English copy behind, and existing rows get correct fallback behaviour
with no backfill. The news form lays both languages out side by side; the
detail page only shows an English section when one was actually added. The
public API returns both languages in one call (title_nl/body_nl/excerpt_nl
alongside title_en/body_en/excerpt_en, the latter never blank) -- a breaking
rename of the previously-unprefixed title/body/excerpt fields.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
2026-08-10 20:47:58 +02:00
parent 0a9ac67b21
commit 5dcffefb28
13 changed files with 265 additions and 31 deletions

View File

@@ -73,6 +73,29 @@ class NewsModelTests(TestCase):
self.assertEqual(item.status, News.Status.DRAFT)
self.assertIsNone(item.published_at)
def test_effective_english_falls_back_to_the_original_when_blank(self):
item = News.objects.create(club=self.club, title="Seizoensstart", body="We beginnen het seizoen.")
self.assertEqual(item.effective_title_en, "Seizoensstart")
self.assertEqual(item.effective_body_en, "We beginnen het seizoen.")
def test_effective_english_uses_its_own_text_when_set(self):
item = News.objects.create(club=self.club, title="Seizoensstart", body="We beginnen het seizoen.", title_en="Season kickoff", body_en="We're starting the season.")
self.assertEqual(item.effective_title_en, "Season kickoff")
self.assertEqual(item.effective_body_en, "We're starting the season.")
def test_effective_english_stays_current_after_the_original_changes(self):
# Read-time fallback, not copy-on-save: editing the Dutch text later must
# not leave a stale English "copy" behind.
item = News.objects.create(club=self.club, title="Seizoensstart", body="We beginnen het seizoen.")
item.title, item.body = "Nieuwe titel", "Nieuwe tekst."
item.save(update_fields=["title", "body"])
self.assertEqual(item.effective_title_en, "Nieuwe titel")
self.assertEqual(item.effective_body_en, "Nieuwe tekst.")
class NewsPhotoModelTests(TestCase):
def setUp(self):