#28074: 1.11 GeoDjango admin template loaders change?
-------------------------------------+-------------------------------------
               Reporter:  Tobi       |          Owner:  nobody
                   Type:             |         Status:  new
  Uncategorized                      |
              Component:  GIS        |        Version:  1.11
               Severity:  Normal     |       Keywords:  geodjango,
           Triage Stage:             |  templates
  Unreviewed                         |      Has patch:  0
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  0          |
-------------------------------------+-------------------------------------
 After upgrading from 1.10.7 to 1.11, `OSMGeoAdmin` with custom
 `map_template` throws a `TemplateDoesNotExist` error.

 Consider an OSMGeoAdmin and a simple view:

 {{{
 class FieldAdmin(OSMGeoAdmin):
     map_template = 'gis/admin/hello_world.html'

 def test_view(request):
     return render(request, 'gis/admin/hello_world.html', {})
 }}}


 The template is in `project_dir/templates/gis/admin/hello_world.html`, and
 the relevant settings are pretty default:
 {{{
 TEMPLATES = [
     {
         'BACKEND': 'django.template.backends.django.DjangoTemplates',
         'DIRS': [os.path.join(BASE_DIR, 'templates'),],
         'APP_DIRS': True,
         'OPTIONS': {
             ...
         },
     },
 ]
 }}}


 The `test_view` finds the template and renders fine, while the
 `FieldAdmin` cannot find the template. Interestingly, the filesystemloader
 is being used, but searches a completely wrong directory (ie definitely
 not my BASE_DIR):

 {{{
 django.template.loaders.filesystem.Loader: /home/ubuntu/env/lib/python3.5
 /site-packages/django/forms/templates/gis/admin/hello_world.html (Source
 does not exist)
 }}}

 Downgrading to 1.10.7 solves this issue.

--
Ticket URL: <https://code.djangoproject.com/ticket/28074>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.61f5060c81c718bfef33d2903862f0ae%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to