Add a home-location box to the club detail page in the control panel
Setting a club's home ground here creates/updates the same events.Location row (flagged is_home) that the club's own Teams > Locations page shows and edits -- no separate sync step, it's the same record either way. Also fixes the shared form_field templatetag: django-countries' CountryField widget reports as "lazyselect", which fell through to a broken plain text input instead of rendering as a dropdown. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01R1gj3J1QPfP38XWpnpbFpy
This commit is contained in:
@@ -6,6 +6,7 @@ from waffle import get_waffle_flag_model
|
||||
|
||||
from billing.models import DuePayment, Subscription, Tier, TierPrice
|
||||
from club.models import Club
|
||||
from events.models import Location
|
||||
|
||||
from .services.admins import find_member_by_email
|
||||
|
||||
@@ -30,6 +31,21 @@ class ClubForm(forms.ModelForm):
|
||||
self.fields["slug"].required = False
|
||||
|
||||
|
||||
class HomeLocationForm(forms.ModelForm):
|
||||
"""Create or update the club's home ground -- this *is* an events.Location row
|
||||
(flagged ``is_home``), the same one that shows up under the club's own
|
||||
Teams > Locations page, so the two stay in sync by construction rather than
|
||||
needing anything to keep them that way."""
|
||||
|
||||
class Meta:
|
||||
model = Location
|
||||
fields = ["name", "address", "city", "zip_code", "country"]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
self.fields["country"].widget.attrs.update({"data-searchable": "true", "data-search-placeholder": _("Type a country to search...")})
|
||||
|
||||
|
||||
class ClubAdminForm(forms.Form):
|
||||
"""Grant club-admin rights to an email address, creating the person if new."""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user