backend icon indicating copy to clipboard operation
backend copied to clipboard

[API Hangouts] Create Serializer for Hangouts Endpoint

Open BethanyG opened this issue 3 years ago • 4 comments

PARENT TRACKER ISSUE: #160

Create a Serializer for the New Hangouts api Endpoint. Please review issue #161 as background to make sure the latest GET representation is used, and any POST differences are taken into consideration.

See DRF ModelSerialize, DRF Serializer Relations, and DRF Nested Relationships for more information.

See https://github.com/codebuddies/backend/blob/master/cbv3_django_prototype/cbv3_django_prototype/resources/serializers.py as one implementation done for resources.

Please note that the serializer code related to Tags is its own endpoint, tagging. Below is an example from the resources endpoint on how tagging is used:

from rest_framework import serializers
from .models import Resource
from userauth.serializers import UserSerializer
from tagging.serializers import TagSerializer, TagsSerializerField


class ResourceSerializer(TagSerializer, serializers.ModelSerializer):

    tags = TagsSerializerField(model_field='tags', default='')
    media_type = serializers.SerializerMethodField()
    user = UserSerializer(read_only=True)

BethanyG avatar Aug 26 '20 09:08 BethanyG