In Django 1.7, I'm unable to provide a custom template. Instead it just defaults to the django_tables2/table.html
from django_tables2 import Table as BaseTable
class Table(BaseTable):
class Meta:
template = 'portal/base_table.html'
And my folder structure:
apps/portal/
├── __init__.py
├── tables.py
├── templates
│ └── portal
│ ├── base.html
│ ├── base_portal.html
│ ├── base_table.html
│ └── home.html
In the above, templates such as portal/base.html
are resolved by template finders.
If I forego the Meta class and instead set:
from django_tables2 import Table as BaseTable
class Table(BaseTable):
template = 'portal/base_table.html'
I instead get the error TemplateDoesNotExist
as it seems to be trying to resolve /data/www/apps/portal/templates/No template names provided
among others.
To further support that I think the template should be resolving:
>>> render_to_response('portal/base_table.html')
<django.http.response.HttpResponse object at 0x7fa940c74690>
>>> render_to_response('portal/base_table.html2')
...
raise TemplateDoesNotExist(name)
TemplateDoesNotExist: portal/base_table.html2
My settings.py
file contains:
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
path = lambda *a: os.path.join(BASE_DIR, *a)
TEMPLATE_DIRS = (
path('templates'),
)
This is working for all other templates such as for Views. Does django-tables2 not use the same lookup method?