Exemple #1
0
def get_people(request, pk):
    people = DoubanPeople.get(pk=pk)

    if people:
        return HttpResponse(people.name)
    else:
        raise Http404("Not Found it.")
Exemple #2
0
def get_peoples(request):
    peoples = DoubanPeople.get_all()
    output = "<br />".join([people.name for people in peoples])
    output += "<br /> %s" % len(peoples)
    # TODO 这里是不是使用序列化, 就不用这么麻烦的转,就是model对象->字符串转换.
    return HttpResponse(output)