Fix rendering file attachment thumbnails in change descriptions.

Review Request #10912 — Created Feb. 24, 2020 and submitted

Information

Review Board
release-4.0.x

Reviewers

The move to Django 1.11 broke rendering of file attachment thumbnails
in change descriptions, due to the usage of a Context class when
calling Template.render(). In modern Django, we only want to pass a
dictionary.

We also want to ensure we're returning safe strings, to prepare for a
future where we're being more strict with field-generated HTML.

This updates rendering to use the modern conventions.

This is only the second field to get an actual unit test suite (a small
one at this point). As such, part of this change splits out the useful
bits of the other field's tests into a common class, making it easier to
add future tests.

Loaded a page with changed file attachments. Instead of blowing up,
it rendered the thumbnails with the correct information.

Unit tests pass.

Summary ID
Fix rendering file attachment thumbnails in change descriptions.
The move to Django 1.11 broke rendering of file attachment thumbnails in change descriptions, due to the usage of a `Context` class when calling `Template.render()`. In modern Django, we only want to pass a dictionary. We also want to ensure we're returning safe strings, to prepare for a future where we're being more strict with field-generated HTML. This updates rendering to use the modern conventions. This is only the second field to get an actual unit test suite (a small one at this point). As such, part of this change splits out the useful bits of the other field's tests into a common class, making it easier to add future tests.
b7ef122a3e94ae0813500702ed05d290acb092e0
david
  1. Ship It!
  2. 
      
chipx86
Review request changed
Status:
Completed
Change Summary:
Pushed to release-4.0.x (51bc2a4)