feat: add source field with 3 options, fix EventListAPI fallback, add is_eventify_event to API response
- Event.source field updated: eventify, community, partner (radio select in form) - EventListAPI: fallback to all events when pincode returns < 6 - EventListAPI: include is_eventify_event and source in serializer - Admin API: add source to list serializer - Django admin: source in list_display, list_filter, list_editable - Event form template: proper radio button rendering for source field Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -36,9 +36,13 @@ class EventForm(forms.ModelForm):
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
# Set source to 'official' only and hide the field
|
||||
self.fields['source'].initial = 'official'
|
||||
self.fields['source'].widget = forms.HiddenInput()
|
||||
# Show source as visible radio buttons with Bootstrap styling
|
||||
self.fields['source'].widget = forms.RadioSelect(
|
||||
choices=self.fields['source'].choices,
|
||||
attrs={'class': 'form-check-input'}
|
||||
)
|
||||
if not self.instance.pk:
|
||||
self.fields['source'].initial = 'eventify'
|
||||
|
||||
# Check if all_year_event is True (from instance or initial data)
|
||||
all_year_event = False
|
||||
@@ -60,8 +64,7 @@ class EventForm(forms.ModelForm):
|
||||
cleaned_data = super().clean()
|
||||
all_year_event = cleaned_data.get('all_year_event', False)
|
||||
|
||||
# Force source to be 'official' only
|
||||
cleaned_data['source'] = 'official'
|
||||
# Source is now user-selectable (eventify/community/partner)
|
||||
|
||||
# If all_year_event is True, clear date/time fields
|
||||
if all_year_event:
|
||||
|
||||
Reference in New Issue
Block a user