- 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>
- MetadataFileField.generate_filename: substitutes a UUID for the original
filename in the upload_to path so new files land at a stable, unguessable
storage path (e.g. sapl/public/norma/2025/9395/<uuid>.pdf). For
replacements the existing UUID is reused; OverwriteStorage replaces bytes
in-place and the public /documentos/<uuid>/ URL never changes. A fresh UUID
is stashed on the instance (_pending_uuid_<field>) and wired into the new
FileMetadata row in pre_save so FileMetadata.uuid always matches the path.
- pre_save Case 2 fix: skip explicit default_storage.delete() when old and new
storage paths are identical (UUID-based replacement) to avoid deleting the
freshly written file that OverwriteStorage already placed at that path.
- MetadataFileFieldSerializer: overrides to_representation only (inherits
DRF FileField for writes) to emit /documentos/<uuid>/ for API responses
instead of the semantic alias .url() returns. SaplSerializerMixin wires it
in via build_standard_field while preserving all normal field kwargs.
- nginx sapl.conf: adds `internal` and `etag on` to /media/ so clients can no
longer fetch files directly; only Django's X-Accel-Redirect reaches the
location.
- settings.py: adds ConditionalGetMiddleware after CommonMiddleware to set
ETag and Last-Modified on Django responses and short-circuit with 304.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Mudando docker/docker-compose.yml para dist/docker-compose.yml
Alteração no readme sobre a atualização do solr no docker
Mudança do caminho do solr no arquivo solr.rst