2015-06-18 23:57:43 -05:00
|
|
|
"""Serializers for the dispatcher API objects."""
|
|
|
|
|
|
|
|
from rest_framework import serializers
|
|
|
|
|
2015-06-19 11:29:00 -05:00
|
|
|
from dispatch.models import Dispatcher, DispatcherAction
|
2015-06-18 23:57:43 -05:00
|
|
|
|
|
|
|
|
2015-06-19 15:08:57 -05:00
|
|
|
class DispatcherActionSerializer(serializers.ModelSerializer):
|
2015-06-18 23:57:43 -05:00
|
|
|
|
|
|
|
class Meta:
|
2015-06-19 15:08:57 -05:00
|
|
|
model = DispatcherAction
|
|
|
|
fields = ('id', 'dispatcher', 'type', 'destination')
|
2015-06-19 11:29:00 -05:00
|
|
|
|
|
|
|
|
2015-06-19 15:08:57 -05:00
|
|
|
class DispatcherSerializer(serializers.ModelSerializer):
|
|
|
|
|
|
|
|
actions = DispatcherActionSerializer(many=True, read_only=True)
|
2015-06-19 11:29:00 -05:00
|
|
|
|
|
|
|
class Meta:
|
2015-06-19 15:08:57 -05:00
|
|
|
model = Dispatcher
|
|
|
|
fields = ('id', 'key', 'actions')
|
2015-06-18 23:57:43 -05:00
|
|
|
|
|
|
|
|
|
|
|
class DispatchMessageSerializer(serializers.Serializer):
|
|
|
|
|
|
|
|
message = serializers.CharField()
|
2015-06-19 10:51:11 -05:00
|
|
|
status = serializers.CharField(read_only=True)
|