【发布时间】:2014-08-24 03:03:36
【问题描述】:
我第一次尝试使用 Django REST 框架,看教程没有模板示例,我可以使用什么模板?我试过 template_name = 'authorListAjax.html' 但我得到了这个回复http://imgur.com/fMlyXDN
views.py
class AccountSerializer(serializers.ModelSerializer):
class Meta:
model = Author
fields = ('subject', 'date', 'time_start')
class AuthorListAll1(ListAPIView):
template_name = 'authorListAjax.html'
queryset = Author.objects.all()
serializer_class = AccountSerializer
paginate_by = 2
paginate_by_param = 'page_size'
max_paginate_by = 100
urls.py
url(r'^ajax/list/$', AuthorListAll1.as_view(), name='ajax_list'),
【问题讨论】:
标签: django django-templates django-views django-rest-framework