2017-07-03 14:42:27 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
|
2020-05-15 19:53:31 +00:00
|
|
|
from wagtail.api.v2.views import BaseAPIViewSet
|
2019-06-14 20:02:15 +00:00
|
|
|
from wagtail.api.v2.serializers import BaseSerializer
|
|
|
|
from wagtail.api.v2.filters import FieldsFilter, OrderingFilter, SearchFilter
|
|
|
|
from wagtail.api.v2.pagination import WagtailPagination
|
2017-07-03 14:42:27 +00:00
|
|
|
|
|
|
|
from .models import Entry
|
|
|
|
|
|
|
|
class EntrySerializer(BaseSerializer):
|
|
|
|
pass
|
|
|
|
|
2020-05-15 19:53:31 +00:00
|
|
|
class EntriesAPIEndpoint(BaseAPIViewSet):
|
2017-07-03 14:42:27 +00:00
|
|
|
base_serializer_class = EntrySerializer
|
|
|
|
filter_backends = [FieldsFilter, OrderingFilter, SearchFilter]
|
|
|
|
extra_api_fields = [
|
|
|
|
'title',
|
|
|
|
'author',
|
|
|
|
'link',
|
|
|
|
'visual',
|
|
|
|
'content',
|
|
|
|
'tags',
|
|
|
|
'published',
|
|
|
|
]
|
|
|
|
name = 'entries'
|
|
|
|
model = Entry
|