0

I have a following code in django:

def index(request):
    template_name = 'desks.html'

   # query = Desk.objects.all()

    desk_list = Desk.objects.all

    paginator = Paginator(desk_list, 5)
    page = paginator.page(1)

    return render_to_response(template_name, {'desk_list': page}, )

Unfortunately, I get the following error: object of type 'instancemethod' has no len()

At my model, I have defined only attributes.

Any idea what a mistake it can be?

4

1 回答 1

7

You probably want to call all:

desk_list = Desk.objects.all()
于 2013-04-15T22:38:12.813 回答