Django-filter: TemplateDoesNotExist: django_filters/rest_framework/form.html

Created on 15 Nov 2016  ·  8Comments  ·  Source: carltongibson/django-filter

I am getting:

Traceback (most recent call last):
  File "/Users/alex/.virtualenvs/storage/lib/python2.7/site-packages/django/core/handlers/exception.py", line 39, in inner
    response = get_response(request)
  File "/Users/alex/.virtualenvs/storage/lib/python2.7/site-packages/django/core/handlers/base.py", line 249, in _legacy_get_response
    response = self._get_response(request)
  File "/Users/alex/.virtualenvs/storage/lib/python2.7/site-packages/django/core/handlers/base.py", line 217, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/Users/alex/.virtualenvs/storage/lib/python2.7/site-packages/django/core/handlers/base.py", line 215, in _get_response
    response = response.render()
  File "/Users/alex/.virtualenvs/storage/lib/python2.7/site-packages/django/template/response.py", line 109, in render
    self.content = self.rendered_content
  File "/Users/alex/.virtualenvs/storage/lib/python2.7/site-packages/rest_framework/response.py", line 72, in rendered_content
    ret = renderer.render(self.data, accepted_media_type, context)
  File "/Users/alex/.virtualenvs/storage/lib/python2.7/site-packages/rest_framework/renderers.py", line 701, in render
    context = self.get_context(data, accepted_media_type, renderer_context)
  File "/Users/alex/.virtualenvs/storage/lib/python2.7/site-packages/rest_framework/renderers.py", line 678, in get_context
    'filter_form': self.get_filter_form(data, view, request),
  File "/Users/alex/.virtualenvs/storage/lib/python2.7/site-packages/rest_framework/renderers.py", line 613, in get_filter_form
    html = backend().to_html(request, queryset, view)
  File "/Users/alex/.virtualenvs/storage/lib/python2.7/site-packages/rest_framework_filters/backends.py", line 34, in to_html
    template = loader.get_template(self.template)
  File "/Users/alex/.virtualenvs/storage/lib/python2.7/site-packages/django/template/loader.py", line 25, in get_template
    raise TemplateDoesNotExist(template_name, chain=chain)
TemplateDoesNotExist: django_filters/rest_framework/form.html

I have:

django-filter==0.15.3
djangorestframework==3.5.3

Perhaps the issues was introducted by?: https://github.com/carltongibson/django-filter/commit/48f35b2b18f942a912ed25b43fcdf6de065c686c

Most helpful comment

Hi @timothycoutlakis - I believe this is the same issue as #666. You may need to add 'django_filters' to INSTALLED_APPS.

All 8 comments

I also have this which might be causing issues:

djangorestframework-filters==0.9.0

I also get this error, using:

django==1.10.6
django-filter==1.0.2
djangorestframework==3.6.2

If I revert to the following, then it works.

django-filter==0.15.3

Hi @timothycoutlakis - I believe this is the same issue as #666. You may need to add 'django_filters' to INSTALLED_APPS.

Thank you @rpkilby, that solved it.

@Adding 'django-filters' in the apps list inside settings.py solved the issue. I was using following configuration as well

django==1.10.6
django-filter==1.0.2
djangorestframework==3.6.2

Django rest framework documentation should be updated

@timothycoutlakis this trick works for me, thanks.

Hi @timothycoutlakis - I believe this is the same issue as #666. You may need to add 'django_filters' to INSTALLED_APPS.
thank you @rpkilby

Was this page helpful?
0 / 5 - 0 ratings