I am trying replace widget template with my own, but I am getting a TemplateDoesNotExist
error.
In app\forms.py:
class SelectPlus(Select):
template_name = 'selectplus.html'
class SimpleForm(ModelForm):
somefield = ModelChoiceField(
queryset=SomeObjects.objects.all(),
widget=SelectPlus(attrs={'url': 'custom_url_to_context'})
)
In settings.py
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [ROOT_PATH, 'templates'],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
],
},
},
In debug trace I see that template-loader doesn't search in apps folders or main template folder:
But all other templates works fine.