class TransactionDescriptionSerializer(serializers.ModelSerializer): narratives = NarrativeSerializer(many=True) class Meta: model = models.TransactionDescription fields = ( 'narratives', )
class ResultTitleSerializer(serializers.ModelSerializer): narratives = NarrativeSerializer(source="*") class Meta: model = iati_models.ResultTitle fields = ( 'narratives', )
class ResultDescriptionSerializer(serializers.ModelSerializer): narratives = NarrativeSerializer(source="*") class Meta: model = iati_models.ResultDescription fields = ( 'narratives', )
class TransactionProviderSerializer(serializers.ModelSerializer): ref = serializers.CharField() type = CodelistSerializer() narratives = NarrativeSerializer(many=True) provider_activity_id = serializers.CharField( source="provider_activity_ref", required=False) class Meta: model = models.TransactionProvider fields = ('ref', 'type', 'provider_activity_id', 'narratives')
class DescriptionSerializer(serializers.ModelSerializer): type = CodelistSerializer() narratives = NarrativeSerializer(many=True) class Meta: model = iati_models.Description fields = ( 'type', 'narratives' )
class TransactionReceiverSerializer(serializers.ModelSerializer): ref = serializers.CharField() type = CodelistSerializer() narratives = NarrativeSerializer(many=True) receiver_activity_id = serializers.CharField( source="receiver_activity_ref") class Meta: model = models.TransactionReceiver fields = ('ref', 'type', 'receiver_activity', 'receiver_activity_id', 'narratives')
class TransactionReceiverSerializer(serializers.ModelSerializer): ref = serializers.CharField() type = CodelistSerializer() narratives = NarrativeSerializer(many=True) receiver_activity = serializers.HyperlinkedRelatedField( read_only=True, view_name='activities:activity-detail') receiver_activity_id = serializers.CharField( source="receiver_activity_ref") class Meta: model = models.TransactionReceiver fields = ('ref', 'type', 'receiver_activity', 'receiver_activity_id', 'narratives')
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', )
class ParticipatingOrganisationSerializer(serializers.ModelSerializer): # TODO: Link to organisation standard (hyperlinked) ref = serializers.CharField(source='normalized_ref') type = CodelistSerializer() role = CodelistSerializer() activity_id = serializers.CharField(source='org_activity_id') narratives = NarrativeSerializer(many=True) class Meta: model = iati_models.ActivityParticipatingOrganisation fields = ( 'ref', 'type', 'role', 'activity_id', 'narratives', )
class ReportingOrganisationSerializer(DynamicFieldsModelSerializer): # TODO: Link to organisation standard (hyperlinked) ref = serializers.CharField(source="normalized_ref") type = CodelistSerializer() secondary_reporter = serializers.BooleanField() narratives = NarrativeSerializer(many=True) # organisation = OrganisationSerializer() organisation = serializers.HyperlinkedRelatedField(view_name='organisations:organisation-detail', read_only=True) class Meta: model = iati_models.ActivityReportingOrganisation fields = ( 'ref', 'organisation', 'type', 'secondary_reporter', 'narratives', )
class TransactionProviderSerializer(serializers.ModelSerializer): ref = serializers.CharField() type = CodelistSerializer() narrative = NarrativeSerializer(many=True, source='narratives') provider_activity = serializers.HyperlinkedRelatedField( read_only=True, view_name='activities:activity-detail') provider_activity_id = serializers.CharField( source="provider_activity_ref", required=False) class Meta: model = models.TransactionProvider fields = ( 'ref', 'type', 'provider_activity', 'provider_activity_id', 'narrative' )
class TitleSerializer(serializers.Serializer): narratives = NarrativeSerializer(many=True) class Meta: model = iati_models.Title fields = ('narratives',)