예제 #1
0
 def validate(self, attrs):
     ticket_type = attrs.get('type')
     org_id = attrs.get('org_id')
     flow = TicketFlow.get_org_related_flows(org_id=org_id).filter(type=ticket_type).first()
     if flow:
         attrs['flow'] = flow
     else:
         error = _('The ticket flow `{}` does not exist'.format(ticket_type))
         raise serializers.ValidationError(error)
     return attrs
예제 #2
0
 def get_queryset(self):
     queryset = TicketFlow.get_org_related_flows()
     return queryset