demo-hackernews-with-django.../app/api/serializers.py

10 lines
233 B
Python
Raw Permalink Normal View History

2021-06-22 15:43:26 +02:00
from app.api.models import News
from rest_framework import serializers
class NewsSerializer(serializers.HyperlinkedModelSerializer):
class Meta:
model = News
2021-06-25 14:25:14 +02:00
fields = ['id', 'title', 'url', 'votes', 'created']
2021-06-22 15:43:26 +02:00