urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^$', views.people),
]
def people(request):
return render(request, 'people.html', {'people': models.Person.objects.all()})
class Person(models.Model):
name = CharField(verbose_name="full name", max_length=10)
{% load render_table from django_tables2 %}
{% load static %}
{% render_table people %}
When I run it, it told me TemplateDoesNotExist at /django_tables2/table.html
, I don't understand why.
First, make sure that django_tables2
is included in your INSTALLED_APPS
setting.
Then, make sure that you have APP_DIRS
set to True
in your TEMPLATES
setting.
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [...],
'APP_DIRS': True,
...
},
]