StudE-Backend/stude/studygroup_messages/serializers.py

15 lines
461 B
Python
Raw Normal View History

from rest_framework import serializers
from .models import Message
from accounts.models import CustomUser
class MessageSerializer(serializers.ModelSerializer):
user = serializers.SlugRelatedField(
2023-06-28 01:18:37 +08:00
queryset=CustomUser.objects.all(), slug_field='full_name', required=False)
study_group = serializers.CharField(
source='subject.Subject', read_only=True, required=False)
class Meta:
model = Message
fields = '__all__'