mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-17 06:19:24 +08:00
14 lines
414 B
Python
14 lines
414 B
Python
|
from rest_framework import serializers
|
||
|
from .models import Message
|
||
|
from accounts.models import CustomUser
|
||
|
|
||
|
|
||
|
class MessageSerializer(serializers.ModelSerializer):
|
||
|
user = serializers.SlugRelatedField(
|
||
|
queryset=CustomUser.objects.all(), slug_field='full_name')
|
||
|
group = serializers.CharField(source='subject.Subject', read_only=True)
|
||
|
|
||
|
class Meta:
|
||
|
model = Message
|
||
|
fields = '__all__'
|