Esempio n. 1
0
class BasicNormalizedDataSerializer(serializers.ModelSerializer):

    source = serializers.HiddenField(default=serializers.CurrentUserDefault())

    class Meta:
        model = models.NormalizedData
        fields = ('data', 'source')
Esempio n. 2
0
class FullNormalizedDataSerializer(serializers.ModelSerializer):

    tasks = serializers.PrimaryKeyRelatedField(many=True, read_only=False, queryset=CeleryTaskResult.objects.all())
    source = serializers.HiddenField(default=serializers.CurrentUserDefault())

    class Meta:
        model = models.NormalizedData
        fields = ('data', 'source', 'raw', 'tasks')
Esempio n. 3
0
class BasicNormalizedDataSerializer(serializers.ModelSerializer):
    # link to self
    url = fields.ShareIdentityField(view_name='api:normalizeddata-detail')

    source = serializers.HiddenField(default=serializers.CurrentUserDefault())

    class Meta:
        model = models.NormalizedData
        fields = ('data', 'source', 'url')
Esempio n. 4
0
class ProviderRegistrationSerializer(ShareModelSerializer):
    status = serializers.SerializerMethodField()
    submitted_at = serializers.DateTimeField(read_only=True)
    submitted_by = serializers.HiddenField(default=serializers.CurrentUserDefault())

    def get_status(self, obj):
        return ProviderRegistration.STATUS[obj.status]

    class Meta:
        model = models.ProviderRegistration
        fields = '__all__'
Esempio n. 5
0
class FullNormalizedDataSerializer(serializers.ModelSerializer):
    # link to self
    url = fields.ShareIdentityField(view_name='api:normalizeddata-detail')

    tasks = serializers.PrimaryKeyRelatedField(
        many=True,
        read_only=False,
        queryset=models.CeleryTaskResult.objects.all())
    source = serializers.HiddenField(default=serializers.CurrentUserDefault())

    class Meta:
        model = models.NormalizedData
        fields = ('data', 'source', 'raw', 'tasks', 'url')
Esempio n. 6
0
class ProjectCreateSerializer(ProjectSerializer):
    slug = serializers.SlugField(
        default=serializers.CreateOnlyDefault(SlugDefault('title')))
    owner = serializers.HiddenField(default=serializers.CurrentUserDefault())