mirror of
https://github.com/lemeow125/InfoTech-Backend.git
synced 2024-11-17 06:29:26 +08:00
13 lines
428 B
Python
13 lines
428 B
Python
|
from rest_framework import serializers
|
||
|
from django.contrib.auth.models import User
|
||
|
from .models import Subject
|
||
|
|
||
|
|
||
|
class SubjectSerializer(serializers.HyperlinkedModelSerializer):
|
||
|
enrolled_count = serializers.IntegerField(required=False, default=0)
|
||
|
|
||
|
class Meta:
|
||
|
model = Subject
|
||
|
fields = ('id', 'name', 'enrolled_count', 'max_slots', 'year_level')
|
||
|
read_only_fields = ('id', 'max_slots')
|