Opened 7 years ago

Closed 7 years ago

#28927 closed Uncategorized (duplicate)

include tag fails silently if included template's static tag fails

Reported by: sodds Owned by: nobody
Component: Uncategorized Version: 1.11
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description (last modified by sodds)

This bug happens under the following conditions:

  1. Static files storage is ManifestStaticFilesStorage
  2. Debug setting is False
  3. Parent template includes child template with {% include 'child.html' %} tag
  4. Child template uses {% load static %} at the top and uses {% static 'missingfile.css' %}
  5. Referenced static file does not exists (or is missing from .json manifest)

The actual result is that the parent template renders fine but the child template does not get included

The expected result is an error, e.g. a status code 500

Change History (2)

comment:1 by sodds, 7 years ago

Description: modified (diff)

comment:2 by Simon Charette, 7 years ago

Resolution: duplicate
Status: newclosed

Since 1.11 Django already raises a warning when an exception occurs during {% include %} and plan to elevate it to an exception in 2.1 so I'm going to close this as duplicate of #27175 which introduced this change.

In the mean time you can either make sure you enable Python warnings and assert none is raised during your test suite execution or force this particular instance of RemovedInDjango21Warning to be converted to an exception using warnings.simplefilter('error', RemovedInDjango21Warning, message='^Rendering \{% include ')

Note: See TracTickets for help on using tickets.
Back to Top