mirror of https://github.com/interlegis/sapl.git
Browse Source
- IMAGE_FIELDS allowlist and serve_image view: cover CasaLegislativa.logotipo,
Partido.logo_partido, Parlamentar.fotografia, Dispositivo.imagem. The view
validates the (app, model, field) triple, fetches the instance, and issues
X-Accel-Redirect to nginx — same mechanism as serve_file but without
FileMetadata involvement (images carry no versioning or access-control
requirement).
- nginx: /media/CACHE/ added as a public exception before the internal
/media/ block so sorl-thumbnail cached thumbnails (fotografia via
{% cropped_thumbnail %}) remain accessible to browsers without going through
Django.
- get_logotipo_url helper in sapl/utils.py: returns the semantic
/imagens/base/casalegislativa/<pk>/logotipo/ URL; avoids circular imports
since sapl/base/views.py imports from sapl/relatorios/views.py.
- LogotipoView updated to redirect to the semantic URL instead of the raw
/media/ path.
- parliament_info context processor: adds logotipo_url to every template
context so base.html and 404.html can render the logo without MEDIA_URL
concatenation.
- 5 HTML templates updated: {% if logotipo %}{{ MEDIA_URL }}{{ logotipo }}
replaced with {% if logotipo_url %}{{ logotipo_url }}.
- relatorios/views.py (4 sites): logotipo_url added to header_context dicts
passed to header_ata.html.
- painel/views.py: brasao computed via get_logotipo_url instead of
casa.logotipo.url (which returns the now-internal /media/ path).
- ImageThumbnailFileInput.get_context: computes semantic_url from IMAGE_FIELDS
when the instance has a PK; image_thumbnail.html uses it as the src fallback
so the edit-form preview remains visible after /media/ became internal.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
file-metafields
13 changed files with 112 additions and 20 deletions
Loading…
Reference in new issue