mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2026-02-05 09:25:18 -05:00
fix(fsm): Fix StateLog.by capture and cycle validation; add photographer field to photos
## FSM State Machine Fixes ### StateLog.by Field Capture - Modified TransitionMethodFactory to pass 'user' as 'by' kwarg to enable django-fsm-log's @fsm_log_by decorator to correctly capture the user who performed the transition - Applied fix to both escalate_transition and create_transition_method - Uses exec() to dynamically create transition functions with correct __name__ before decorators are applied, ensuring django-fsm's method registration works ### Cycle Validation Behavior - Changed validate_no_cycles() to return ValidationWarning instead of ValidationError - Cycles are now treated as warnings, not blocking errors, since cycles are often intentional in operational status FSMs (e.g., reopening after temporary closure) ### Ride Status Transitions - Added TEMPORARY_CLOSURE -> OPERATING transition (reopen after temporary closure) - Added SBNO -> OPERATING transition (revival - ride returns to operation) ## Field Parity ### Photo Models - Added 'photographer' field to RidePhoto and ParkPhoto models - Maps to frontend 'photographer_credit' field for full schema parity - Includes corresponding migrations for both apps ### Serializers - Added 'photographer' to RidePhotoSerializer and ParkPhotoSerializer read_only_fields
This commit is contained in:
@@ -117,6 +117,7 @@ class RidePhotoOutputSerializer(serializers.ModelSerializer):
|
||||
"image_url",
|
||||
"image_variants",
|
||||
"caption",
|
||||
"photographer",
|
||||
"alt_text",
|
||||
"is_primary",
|
||||
"is_approved",
|
||||
@@ -156,6 +157,7 @@ class RidePhotoCreateInputSerializer(serializers.ModelSerializer):
|
||||
fields = [
|
||||
"image",
|
||||
"caption",
|
||||
"photographer",
|
||||
"alt_text",
|
||||
"photo_type",
|
||||
"is_primary",
|
||||
@@ -169,6 +171,7 @@ class RidePhotoUpdateInputSerializer(serializers.ModelSerializer):
|
||||
model = RidePhoto
|
||||
fields = [
|
||||
"caption",
|
||||
"photographer",
|
||||
"alt_text",
|
||||
"photo_type",
|
||||
"is_primary",
|
||||
|
||||
Reference in New Issue
Block a user