Ejemplo n.º 1
0
class MarkSerializer(serializers.ModelSerializer):
    given_by = UserNameSerializer()
    last_changed_by = UserNameSerializer()

    class Meta:
        model = Mark
        fields = (
            "title",
            "added_date",
            "last_changed_date",
            "description",
            "category",
            "given_by",
            "last_changed_by",
        )
Ejemplo n.º 2
0
class MarkSerializer(serializers.ModelSerializer):
    given_by = UserNameSerializer()
    last_changed_by = UserNameSerializer()

    class Meta:
        model = Mark
        fields = (
            'title',
            'added_date',
            'last_changed_date',
            'description',
            'category',
            'given_by',
            'last_changed_by',
        )
Ejemplo n.º 3
0
class UserTagReadOnlySerializer(serializers.ModelSerializer):
    user = UserNameSerializer()

    class Meta:
        model = UserTag
        fields = ("id", "user", "created_date", "photo")
        read_only = True
Ejemplo n.º 4
0
class MarkSerializer(serializers.ModelSerializer):
    given_by = UserNameSerializer()
    last_changed_by = UserNameSerializer()
    category_display = serializers.SerializerMethodField()

    def get_category_display(self, mark: Mark):
        return mark.get_category_display()

    class Meta:
        model = Mark
        fields = (
            "title",
            "added_date",
            "last_changed_date",
            "description",
            "category",
            "category_display",
            "given_by",
            "last_changed_by",
        )
Ejemplo n.º 5
0
class AlbumReadOnlySerializer(serializers.ModelSerializer):
    created_by = UserNameSerializer()
    tags = TagListSerializerField()
    cover_photo = PhotoReadOnlySerializer()

    class Meta:
        model = Album
        fields = (
            "id",
            "title",
            "description",
            "created_date",
            "published_date",
            "tags",
            "photos",
            "public",
            "created_by",
            "cover_photo",
        )
        read_only = True
Ejemplo n.º 6
0
class ClientReadOnlySerializer(serializers.ModelSerializer):
    owner = UserNameSerializer()

    class Meta:
        model = Client
        read_only = True
        fields = (
            "id",
            "name",
            "owner",
            "date_created",
            "website_url",
            "terms_url",
            "contact_email",
            "logo",
            "require_consent",
            "reuse_consent",
            "scope",
            "response_types",
        )
Ejemplo n.º 7
0
class ClientReadOnlySerializer(serializers.ModelSerializer):
    owner = UserNameSerializer()

    class Meta:
        model = Client
        read_only = True
        fields = (
            'id',
            'name',
            'owner',
            'date_created',
            'website_url',
            'terms_url',
            'contact_email',
            'logo',
            'require_consent',
            'reuse_consent',
            'scope',
            'response_types',
        )
Ejemplo n.º 8
0
class PhotoReadOnlySerializer(serializers.ModelSerializer):
    photographer = UserNameSerializer()
    tags = TagListSerializerField()
    image = ResponsiveImageSerializer()

    class Meta:
        model = Photo
        fields = (
            "id",
            "album",
            "relative_id",
            "image",
            "created_date",
            "title",
            "description",
            "tags",
            "photographer_name",
            "photographer",
            "user_tags",
        )
        read_only = True