Spaces:
Sleeping
Sleeping
Download api/serializers/content.py from Dayozoe/harvestconnect-api: direct link, hf CLI and curl.
- Browser
- Download file 681 Bytes
-
https://huggingface.co/spaces/Dayozoe/harvestconnect-api/resolve/main/api/serializers/content.py
- Command line
-
hf download hf://spaces/Dayozoe/harvestconnect-api/api/serializers/content.py
-
curl -L -o content.py https://huggingface.co/spaces/Dayozoe/harvestconnect-api/resolve/main/api/serializers/content.py
681 Bytes
| from rest_framework import serializers | |
| from ..models import BlogPost | |
| from .common import UserSerializer, ExternalOrLocalImageField | |
| class BlogPostSerializer(serializers.ModelSerializer): | |
| author = UserSerializer(read_only=True) | |
| author_id = serializers.PrimaryKeyRelatedField(read_only=True) | |
| image = ExternalOrLocalImageField(required=False, allow_null=True) | |
| class Meta: | |
| model = BlogPost | |
| fields = [ | |
| 'id', 'title', 'slug', 'excerpt', 'content', 'category', | |
| 'author', 'author_id', 'featured', 'image', 'views', 'created_at', 'updated_at' | |
| ] | |
| read_only_fields = ['id', 'slug', 'created_at', 'updated_at', 'views'] | |