Ejemplo n.º 1
0
class NetworkQuery(serializers.Serializer):
    page = serializers.IntegerField(required=False,
                                    help_text="Page of filter",
                                    default=1,
                                    min_value=1)
    per_page = serializers.IntegerField(
        required=False,
        help_text="Per Page of filter",
        default=10,
        max_value=100,
    )
    status = serializers.ChoiceField(
        required=False,
        help_text=NetworkStatus.get_info("Network Status:", list_str=True),
        choices=NetworkStatus.to_choices(True),
    )

    class Meta:
        model = Network
        fields = ("page", "per_page", "name")
        extra_kwargs = {"name": {"required": False}}
Ejemplo n.º 2
0
class NetworkResponse(serializers.Serializer):
    status = serializers.ChoiceField(
        help_text=NetworkStatus.get_info(), choices=NetworkStatus.to_choices()
    )
Ejemplo n.º 3
0
class AgentResponse(AgentIDSerializer, AgentCreateBody):
    status = serializers.ChoiceField(help_text=NetworkStatus.get_info(),
                                     choices=NetworkStatus.to_choices())
    created_at = serializers.DateTimeField(help_text="Create time")
    schedulable = serializers.BooleanField(
        help_text="Whether agent can be schedulable")
Ejemplo n.º 4
0
class AgentQuery(PageQuerySerializer):
    status = serializers.ChoiceField(
        required=False,
        help_text=NetworkStatus.get_info(),
        choices=NetworkStatus.to_choices(),
    )