class ExportSerializer(ModelSerializer): """ Base serializer for Exports. """ pulp_href = ExportIdentityField() task = RelatedField( help_text=_('A URI of the task that ran the Export.'), queryset=models.Task.objects.all(), view_name='tasks-detail', ) exported_resources = ExportedResourcesSerializer( help_text=_('Resources that were exported.'), read_only=True, many=True, ) params = serializers.JSONField( help_text=_( 'Any additional parameters that were used to create the export.'), required=False, ) class Meta: model = models.Export fields = ModelSerializer.Meta.fields + ('task', 'exported_resources', 'params')
class ExportSerializer(ModelSerializer): """ Base serializer for Exports. """ pulp_href = ExportIdentityField() task = RelatedField( help_text=_("A URI of the task that ran the Export."), queryset=models.Task.objects.all(), view_name="tasks-detail", required=False, allow_null=True, ) exported_resources = ExportedResourceField( help_text=_("Resources that were exported."), many=True, read_only=True, view_name= "None", # This is a polymorphic field. The serializer does not need a view name. ) params = serializers.JSONField( help_text=_( "Any additional parameters that were used to create the export."), read_only=True, ) class Meta: model = models.Export fields = ModelSerializer.Meta.fields + ("task", "exported_resources", "params")