I am a little bit confused.
https://github.com/carltongibson/django-filter/blob/develop/django_filters/rest_framework/backends.py
From line 31 to 37 - here is a logic, if I have crispy instaled, package should use django_filters/rest_framework/crispy_form.html file.
I have installed all newest packages of django-filter and crispy forms, but all the time I have an error in my code:
Exception Type: TemplateDoesNotExist Exception Value:
django_filters/rest_framework/crispy_form.html
Could you please explain me where I can find all needed templates? Which repo? I don't see these files in django-filter repo, so I am little bit lost.
To configure the Django template system, go to the settings.py file and update the DIRS to the path of the templates folder. Generally, the templates folder is created and kept in the sample directory where manage.py lives. This templates folder contains all the templates you will create in different Django Apps.
You can't do this, which is by design. The Django framework authors intended a strict separation of presentation code from data logic. Filtering models is data logic, and outputting HTML is presentation logic.
Django Code The template tags are a way of telling Django that here comes something else than plain HTML. The template tags allows us to to do some programming on the server before sending HTML to the client.
You may need to add 'django_filters' to INSTALLED_APPS. I had same issue resolved by doing this.
I have installed all newest packages of django-filter and crispy forms...
Please check this.
The backend catches the missing template exception so you shouldn't see that error.
The reason you can't see the template file is that the default templates are defined in the module, to avoid the extra files and the need to add Django Filter to INSTALLED_APPS
. You can override these by adding files at the expected path(s).
The behaviour you're seeing is unexpected so if you can reduce it to a minimal reproducible example please open an issue on GitHub.
Please look at the test case here — this covers the exact behaviour:
Ensure backend renders default if template path does not exist
The question is, why is that not working in your case?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With