serializers.py 442 B

1234567891011121314151617181920
  1. from rest_framework import serializers
  2. from content.models import Author
  3. class AuthorRelationSerializer(serializers.ModelSerializer):
  4. class Meta:
  5. model = Author
  6. fields = ["id", "uuid", "name", ]
  7. read_only_fields = ["uuid", ]
  8. class AuthorSerializer(serializers.ModelSerializer):
  9. class Meta:
  10. model = Author
  11. fields = ["id", "uuid", "name", "avatar",]
  12. read_only_fields = ["uuid", ]