Did we consider defining a template loader that knows where to load the 
widget
templates from instead of requiring 'django.forms' in INSTALLED_APPS with
'APP_DIRS': True in TEMPLATES?

Something along theese lines make more sense to me:

TEMPLATES = {
    {   
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [], 
        'APP_DIRS': True,
        'OPTIONS': {
            'loaders': [
                'django.forms.templates.loader.WidgetTemplateLoader',
            ]
        },
    },
}

Simon

Le samedi 14 mai 2016 10:03:57 UTC-4, Tim Graham a écrit :
>
> While testing this, I ran into a shortcoming with the fallback strategy 
> for backwards-compatibility. 
>
> If you have a DjangoTemplates backend configured with 'APP_DIRS': True (as 
> in the tutorial) and you try to visit /admin/auth/user/#/change/ which 
> renders the ReadOnlyPasswordHashWidget, the template system will crash with 
> TemplateDoesNotExist because it can find the widget's template using the 
> app_directories loader but not the 'django/forms/widgets/attrs.html' 
> template that the first template includes. Since the first template is 
> found using what's configured in TEMPLATES (which doesn't know about any of 
> the built-in form templates), the standalone engine needed to find the 
> built-in templates is ignored.
>
> I guess it will affect every project that uses the admin. I can't think 
> of a simple solution other than adding a system check upgrade warning to 
> detect this situation ('django.contrib.admin' in INSTALLED_APPS but not 
> 'django.forms') and advise the user to add 'django.forms' to 
> INSTALLED_APPS. Thoughts?
>
> On Thursday, May 12, 2016 at 1:17:23 PM UTC-4, Carl Meyer wrote:
>>
>> On 05/12/2016 09:39 AM, Tim Graham wrote: 
>> > So this discussion doesn't stall the rest of the patch, I suggest 
>> > keeping the fallbacks for now and deprecation them later if they cause 
>> > confusion or other problems. 
>>
>> Yes, I think that makes sense. 
>>
>> Carl 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/b9de7eac-9412-482f-9e79-809d1293f6eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to