Skip to content

Commit

Permalink
Create endpoints for RO/TO choice fields
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed Dec 4, 2024
1 parent 484d117 commit e7c9cb8
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions backend/ebios_rm/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,19 @@ class FearedEventViewSet(BaseModelViewSet):

class RoToViewSet(BaseModelViewSet):
model = RoTo

@action(detail=False, name="Get risk origin choices", url_path="risk-origin")
def risk_origin(self, request):
return Response(dict(RoTo.RiskOrigin.choices))

@action(detail=False, name="Get motivation choices")
def motivation(self, request):
return Response(dict(RoTo.Motivation.choices))

@action(detail=False, name="Get resources choices")
def resources(self, request):
return Response(dict(RoTo.Resources.choices))

@action(detail=False, name="Get pertinence choices")
def pertinence(self, request):
return Response(dict(RoTo.Pertinence.choices))

0 comments on commit e7c9cb8

Please sign in to comment.