Exemplo n.º 1
0
    class AdministrativeSerializer(serializers.ModelSerializer):
        code = serializers.CharField()
        vocabulary = VocabularySerializer()

        class Meta:
            model = iati_models.LocationAdministrative
            fields = (
                'code',
                'vocabulary',
                'level',
            )
Exemplo n.º 2
0
class TransactionSectorSerializer(serializers.ModelSerializer):
    sector = SectorSerializer(fields=('url', 'code', 'name'))
    vocabulary = VocabularySerializer()
    vocabulary_uri = serializers.URLField()

    class Meta:
        model = models.TransactionSector
        fields = (
            'id',
            'sector',
            'vocabulary',
            'vocabulary_uri',
        )
Exemplo n.º 3
0
class TransactionRecipientRegionSerializer(DynamicFieldsModelSerializer):
    region = BasicRegionSerializer(fields=('url', 'code', 'name'), )
    vocabulary = VocabularySerializer()
    vocabulary_uri = serializers.URLField(required=False)

    class Meta:
        model = models.TransactionRecipientRegion
        fields = (
            'id',
            'region',
            'vocabulary',
            'vocabulary_uri',
        )
Exemplo n.º 4
0
class HumanitarianScopeSerializer(DynamicFieldsModelSerializer):
    type = CodelistSerializer() 
    vocabulary = VocabularySerializer()
    vocabulary_uri = serializers.URLField()
    code = CodelistSerializer()

    class Meta:
        model = iati_models.HumanitarianScope
        fields = (
            'type',
            'vocabulary',
            'vocabulary_uri',
            'code',
        )
Exemplo n.º 5
0
class ActivityPolicyMarkerSerializer(serializers.ModelSerializer):
    code = CodelistSerializer()
    vocabulary = VocabularySerializer()
    vocabulary_uri = serializers.URLField()
    significance = CodelistSerializer()
    narratives = NarrativeSerializer(many=True)

    class Meta:
        model = iati_models.ActivityPolicyMarker
        fields = (
            'narratives',
            'vocabulary',
            'vocabulary_uri',
            'significance',
            'code',
        )
Exemplo n.º 6
0
class ActivitySectorSerializer(serializers.ModelSerializer):
    sector = SectorSerializer(fields=('url', 'code', 'name'))
    percentage = serializers.DecimalField(
        max_digits=5,
        decimal_places=2,
        coerce_to_string=False
    )
    vocabulary = VocabularySerializer()
    vocabulary_uri = serializers.URLField()

    class Meta:
        model = iati_models.ActivitySector
        fields = (
            'sector',
            'percentage',
            'vocabulary',
            'vocabulary_uri',
        )
Exemplo n.º 7
0
class ActivityRecipientRegionSerializer(DynamicFieldsModelSerializer):
    region = RegionSerializer(
        fields=('url', 'code', 'name')
    )
    percentage = serializers.DecimalField(
        max_digits=5,
        decimal_places=2,
        coerce_to_string=False
    )
    vocabulary = VocabularySerializer()
    vocabulary_uri = serializers.URLField()

    class Meta:
        model = iati_models.ActivityRecipientRegion
        fields = (
            'region',
            'percentage',
            'vocabulary',
            'vocabulary_uri',
        )
Exemplo n.º 8
0
 class LocationIdSerializer(serializers.Serializer):
     vocabulary = VocabularySerializer(source='location_id_vocabulary')
     code = serializers.CharField(source='location_id_code')