Add billing-ending banner, events CRUD, RBIHF import, public API, team photos, and sponsors
A large batch of club-management features built up over one session: - Club dashboard banner warning admins 1 month before billing ends - Full Events/EventSeries CRUD (recurrence builder, occurrence lifecycle, per-team permissions), with match->game rename and game-specific fields (score, competition, live status, external game ID) - Django-admin competition dropdown, gated per-club by feature flag - Auto-import of RBIHF fixtures (scrape -> diff -> preview -> confirm), with location/opponent dropdowns suggested from existing club data - Feature-flag-gated Shop/Forms nav sections, reusing the same flag machinery for the RBIHF import button - Team roster now scoped to members active this season or next, sorted and grouped by position - Club sport type (ice hockey / other), shown in the control panel's club subtitle - Per-season team photo upload from the team page - New public read-only API (Django Ninja) at /api/v1/: news, team rosters, upcoming/live/per-team games, and sponsors -- auto-documented via Swagger UI, CORS-enabled for a club's own external website - Club sponsors: admin-only CRUD (logo, URL, active date window) plus a date-windowed, optionally randomized API endpoint - Assorted fixes: NullBooleanField dropdown rendering, cross-club event validation timing, searchable-select chip placement, btn-neutral -> default button style sweep, calendar-month chart windows Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R1gj3J1QPfP38XWpnpbFpy
This commit is contained in:
@@ -40,6 +40,13 @@ class Flag(AbstractUserFlag):
|
||||
|
||||
def _get_club_ids(self) -> set:
|
||||
"""Club ids this flag is on for, cached the way waffle caches its own M2Ms."""
|
||||
if self.pk is None:
|
||||
# waffle's own BaseModel.get() falls back to a transient, unsaved
|
||||
# Flag(name=...) instance for a name nothing in the DB matches yet
|
||||
# (see waffle/models.py) -- an M2M lookup can't run against that, and
|
||||
# there's genuinely nothing for it to be on for anyway.
|
||||
return set()
|
||||
|
||||
cache = get_cache()
|
||||
cache_key = keyfmt(FLAG_CLUBS_CACHE_KEY, self.name)
|
||||
|
||||
|
||||
@@ -73,6 +73,14 @@ class ClubScopedFlagTests(TestCase):
|
||||
|
||||
self.assertFalse(flag_is_active(self.request_for(None), "shop"))
|
||||
|
||||
def test_a_flag_name_with_no_matching_row_is_off_not_an_error(self):
|
||||
# Regression: waffle's own BaseModel.get() falls back to a transient,
|
||||
# unsaved Flag(name=...) instance when nothing in the DB matches the
|
||||
# name -- an M2M lookup (self.clubs) against that unsaved instance used
|
||||
# to raise ValueError instead of just resolving to "off". This is the
|
||||
# normal state for any flag nobody has created in the control panel yet.
|
||||
self.assertFalse(flag_is_active(self.request_for(self.club), "no-such-flag"))
|
||||
|
||||
def test_is_active_for_club_without_a_request(self):
|
||||
self.flag.clubs.add(self.club)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user