Python Django-tables2:ValueError位于/interactive_table/预期的表或queryset,而不是str

Python Django-tables2:ValueError位于/interactive_table/预期的表或queryset,而不是str,python,django,django-tables2,Python,Django,Django Tables2,我跟随了Django-tables2教程(可以在这里找到:)。到目前为止,我已经修复了所有错误,但我遇到了一个无法解决的错误。它说我的代码需要一个表或查询集,而不是字符串 我环顾四周,这个问题的所有解决方案都归咎于版本过时,但我已经对它进行了更新,仍然出现了这个错误 有人知道我做错了什么吗 以下是我的视图.py: from django.shortcuts import render from interactive_table import models def people(request

我跟随了Django-tables2教程(可以在这里找到:)。到目前为止,我已经修复了所有错误,但我遇到了一个无法解决的错误。它说我的代码需要一个表或查询集,而不是字符串

我环顾四周,这个问题的所有解决方案都归咎于版本过时,但我已经对它进行了更新,仍然出现了这个错误

有人知道我做错了什么吗

以下是我的视图.py:

from django.shortcuts import render
from interactive_table import models

def people(request):
    return render(request, 'template.html', {'obj': models.people.objects.all()})
这是我的models.py:

    from django.db import models

class people(models.Model):
    name = models.CharField(max_length = 40, verbose_name = 'Full Name')
这是我的template.html:

{# tutorial/templates/people.html #}
{% load render_table from django_tables2 %}
<!doctype html>
<html>
    <head>
        <link rel="stylesheet" href="{{ STATIC_URL }}django_tables2/themes/paleblue/css/screen.css" />
    </head>
    <body>
        {% render_table people %}
    </body>
</html>
{#tutorial/templates/people.html}
{%load render_Tables from django_Tables 2%}
{%render_table people%}

在渲染功能中将
obj
更改为
people

尝试了解模板和模板变量如何与django一起工作


文档可能是在渲染功能中将
obj
更改为
people
的好地方

尝试了解模板和模板变量如何与django一起工作


文档可能是更改模板响应以返回
people
而不是
obj
的好地方

return render(request, 'template.html', {'people': models.people.objects.all()})

将模板响应更改为返回
people
而不是
obj

return render(request, 'template.html', {'people': models.people.objects.all()})

您将“obj”返回到模板而不是“人”您将“obj”返回到模板而不是“人”