mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-23 00:31:08 -05:00
Add test utilities and state machine diagrams for FSM models
- Introduced reusable test utilities in `backend/tests/utils` for FSM transitions, HTMX interactions, and common scenarios. - Added factory functions for creating test submissions, parks, rides, and photo submissions. - Implemented assertion helpers for verifying state changes, toast notifications, and transition logs. - Created comprehensive state machine diagrams for all FSM-enabled models in `docs/STATE_DIAGRAMS.md`, detailing states, transitions, and guard conditions.
This commit is contained in:
@@ -132,6 +132,29 @@ def park_actions(request: HttpRequest, slug: str) -> HttpResponse:
|
||||
return render(request, "parks/partials/park_actions.html", {"park": park})
|
||||
|
||||
|
||||
def park_status_actions(request: HttpRequest, slug: str) -> HttpResponse:
|
||||
"""Return FSM status actions for park moderators"""
|
||||
park = get_object_or_404(Park, slug=slug)
|
||||
|
||||
# Only show to moderators
|
||||
if not request.user.has_perm('parks.change_park'):
|
||||
return HttpResponse("")
|
||||
|
||||
return render(request, "parks/partials/park_status_actions.html", {
|
||||
"park": park,
|
||||
"user": request.user
|
||||
})
|
||||
|
||||
|
||||
def park_header_badge(request: HttpRequest, slug: str) -> HttpResponse:
|
||||
"""Return the header status badge partial for a park"""
|
||||
park = get_object_or_404(Park, slug=slug)
|
||||
return render(request, "parks/partials/park_header_badge.html", {
|
||||
"park": park,
|
||||
"user": request.user
|
||||
})
|
||||
|
||||
|
||||
def get_park_areas(request: HttpRequest) -> HttpResponse:
|
||||
"""Return park areas as options for a select element"""
|
||||
park_id = request.GET.get("park")
|
||||
|
||||
Reference in New Issue
Block a user