diff options
-rw-r--r-- | CHANGES.md | 485 | ||||
-rw-r--r-- | changelog/en/changelog_1.md | 487 | ||||
-rw-r--r-- | changelog/fr/changelog_1.md | 86 | ||||
-rw-r--r-- | example_project/settings.py | 2 | ||||
-rw-r--r-- | ishtar_common/context_processors.py | 70 | ||||
-rw-r--r-- | ishtar_common/migrations/0227_auto_20230406_1834.py (renamed from ishtar_common/migrations/0227_auto_20230404_1112.py) | 12 | ||||
-rw-r--r-- | ishtar_common/models.py | 6 | ||||
-rw-r--r-- | ishtar_common/templates/ishtar/changelog.html | 18 | ||||
-rw-r--r-- | ishtar_common/templates/navbar.html | 3 | ||||
-rw-r--r-- | ishtar_common/tests.py | 48 | ||||
-rw-r--r-- | ishtar_common/urls.py | 3 | ||||
-rw-r--r-- | ishtar_common/views.py | 50 |
12 files changed, 776 insertions, 494 deletions
diff --git a/CHANGES.md b/CHANGES.md index 5615d8923..d9df7bea0 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,490 +1,9 @@ --- title: Ishtar changelog -date: 2023-03-17 +date: 2024-04-07 --- Ishtar changelog ================ -### Features/improvements ### -- Load task refactoring - manage external_id regen with tasks -- Containers: manage history -- Manage expiration of passwords -- Manage strong password policy (ISHTAR_STRONG_PASSWORD_POLICY) with "Each character type" validator -- Add default auth validator -- Update and fix translations (refs #5578, refs #5579, refs #5581) -- Default timeout for session is set to 5 days -- Optional security for login attempt: loging, deactivate account after many failed login. -- Force using 128 bits salt for password hasher - -### Bug fixes ### -- Json fields: fix bad save of multi values -- Cascade update from warehouse to containers (refs #5432) -- Sheets: fix history view with associated geo -- Containers: remove division search -- Importer export: fix pre_importer call -- Image detail: do not display Modify link when not relevant (refs #5438) -- Fix french label for geo types (refs #5577) -- Fix permissions for treatments requests (refs #5441) - -v4.0.43 - 2023-03-17 --------------------- - -### Features/improvements ### -- General: - - add custom cached_label configuration for each main item - - add "created" field on main items in order to facilitate queries -- settings: add "ISHTAR_SECURE_OPTIONS" to activate Django secured options -- Sheet document: better UI for files -- Model: add history for document and containers -- Menu: remove "Administration" entry - put Account management in "Directory" entry -- Admin: - - Global variable: edit in table, add import/export in CSV/JSON - - overload index to add subsection headers -- Geo: create/edit form - new openlayers version - add default IGN tiles -- Import: improve bad encoding detection -- Search: - - add created before/after field - - Operation: add "old code" field - - Find: add "remain" field (operations and sites) - - Account: add "profile type" field -- Free text search: - - use accent and unaccented string - - add french_archeo thesaurus config - - File - add "year-index" -- Maintenance scripts: delete deprecated and migrate to ishtar_maintenance -- Put a serif font for <pre> -- Sheet: - - Treatment file: add associated image and document list - -### Bug fixes ### -- Search: - - fix many excluded facet - - improve many facet query - - Document - source type is now a hierarchic search - - Context record: add identification and activity criteria -- File: filter plan action when preventive_operator is activated in profile -- Profile: - - do not display geo item list when mapping is deactivated - - custom footer message -- Explicit message on associated container deletion when a warehouse is deleted -- Administrative act: add a warning when associated item is deleted -- Imports: register automatically type models for export -- Site: quick action for creation of virtual operation from site with many operations -- UI: - - sheet header - add caret to show collapse - - show/hide password on login -- Forms: - - custom form - can add header message - - Find: remove TAQ/TPQ check - -- Sheet: - - fix treatment and file treatment sheet display (bad QR code link) - - Operation - statistics number of parcels fix - - basket: display shared with by alpha order - -v4.0.42 - 2023-01-25 --------------------- - -### Features/improvements ### -- Sheet treatment: improve layout - add detail links -- Allow complex format for formula - -### Bug fixes ### -- Installation: fix installation script to allow custom DB PORT and DB HOST - -v4.0.41 - 2023-01-23 --------------------- - -### Bug fixes ### -- Fix javascript filter on field - -v4.0.40 - 2023-01-22 --------------------- - -### Features/improvements ### -- Improve some translations - -v4.0.39 - 2023-01-20 --------------------- - -### Features/improvements ### -- Person search: salutation/title fields - -v4.0.38 - 2023-01-20 --------------------- - -### Bug fixes ### -- PDF export: fix new line on <pre> blocks -- Sheet warehouse: prevent duplicate label - - -v4.0.37 - 2023-01-20 --------------------- - -### Bug fixes ### -- Find search: fix discovery date search -- Sheet find/container: fix date and float format - - -v4.0.36 - 2023-01-20 --------------------- - -### Features/improvements ### -- Sheet find refactoring -- Free search: - - "raw" index for reference (add in index whole reference and split ref) - - improve parent only search index -- Warehouse: new slug field to prevent ID change when name is changed -- Warehouse: cached town column -- Change labels - - Identifiant musée -> Numéro d'inventaire musée - - Localisation (fiche) -> Localisation géographique - - Date de découverte (exacte ou TPQ) -> Date de découverte (exacte ou début) - - Date de découverte (TAQ) -> Date de découverte (fin) - - -v4.0.35 - 2023-01-18 --------------------- - -### Bug fixes ### -- WIP: fix types searches with * -- Imports: fix cultural attribution import -- Table: fix default sort when pk is not "id" -- Sheet: - - warehouse: fix localisation - fix data - - container: fix localisation - fix data -- Admin: container and warehouse performance - -v4.0.34 - 2023-01-13 --------------------- - -### Bug fixes ### -- Syndication: - - sheet - fix set default permissions - - admin ApiSearchModel - fix exporter filter for Find - - sheet - fix display detail of a dict (display associated label) - - table - select/deselect all - - table - reinit headers on load - -v4.0.33 - 2023-01-12 --------------------- - -### Features/improvements ### -- Search result - export: export only selected -- Commands: manage update search vector with maintenance script -- utils: adapt to v4 OSM relations importer -- Syndication ui: better color for external sources -- Syndication - export external sources -- Search: sort by ID by default -- UI bootstrap for stats - -### Bug fixes ### -- Fix geo finds for external sources: do not display -- Fix pinned search for external source -- Fix strange bug on statistics with criteria - -v4.0.32 - 2022-12-12 --------------------- - -### Features/improvements ### -- Sheet: set default permissions to False -- Find sheet: do not display container information if no permission -- Image field: can use camera for mobile device -- Import value formater: can use {item} notation for format - -### Bug fixes ### -- Full text search: add "simple" config in search - -v4.0.31 - 2022-12-05 --------------------- - -### Features/improvements ### -- Admin: importer model export -- Imports: manage defaults with "__" - -### Bug fixes ### -- Migration v4: disable M2M post treatment - -v4.0.30 - 2022-12-02 --------------------- - -### Improvements ### -- Use supervisor instead of systemd script for celery daemon -- Forms: minor template fix - - -v4.0.29 - 2022-11-29 --------------------- - -### Improvements ### -- Context record: add Unit to indexed search -- Import: add ActType to imported types -- Admin: small improvements on syndication - -### Bug fixes ### -- Fix redirect URL after logout -- Fix choice display - non-relevant translation is deactivated -- Minor translation fixes - - -v4.0.28 - 2022-11-18 --------------------- - -### Improvements ### -- Admin: site profile - better form layout -- Imports: display post-process advance -- File refactoring -- Remove dead code - -### Bug fixes ### -- Fix import when no object is created and no error is caught -- Operation from file creation - fix automatic town association and parcel recopy - -v4.0.27 - 2022-11-10 --------------------- - -## Features ## -- Improve tests -- French translation - -### Bug fix ### -- Fix m2m display for historized items - - -v4.0.26 - 2022-11-08 --------------------- - -### Features ### -- remove deprecated x, y, z fields on main item forms - -### Bug fix ### -- Sheet find: fix map display -- Find form: fix order of decoration field - - -v4.0.25 - 2022-11-07 --------------------- - -### Features ### -- Geodata: display first item associated as a name when no name is provided - -### Bug fix ### -- Geodata import: fix total number evaluation on imports -- Basket modification: fix wizard update - - -v4.0.24 - 2022-10-27 --------------------- - -### Bug fix ### -- Geodata save: transactions to limit deadlocks - - -v4.0.23 - 2022-10-26 --------------------- - -### Features ### -- Geo data: zoom to extent - -### Bug fix ### -- Geodata post save: transactions and targeted post save to limit deadlocks - -v4.0.22 - 2022-10-14 --------------------- - -### Features ### -- Context records: Excavation technic become many-to-many - -v4.0.21 - 2022-10-14 --------------------- - -### Features ### -- Geo: quick add geo action for context records, sites and finds -- Geo data: manage m2m association and cascade association - -### Bug fix ### - -- Geo data: fix main_geodata association test -- fix some admin pages - -v4.0.20 - 2022-10-03 --------------------- - -### Features ### - -Geo form - redirect to source item after edit - - -v4.0.19 - 2022-09-18 --------------------- - -Backport of v3 changes. - -v4.0.18 - 2022-09-12 --------------------- - -### Features ### - -- Import GIS: default to 0 skip lines (for geopackage and SHP it must be 0) - -### Bug fix ### - -- Geo - migration script: more tolerant with no geo item data - main geo is poly when defined - -v4.0.17 - 2022-09-10 --------------------- - -### Bug fix ### - -- Geo: fix zoom to the extent - fix item counts - -v4.0.16 - 2022-09-09 --------------------- - -### Features ### - -- Geo: display associated context records and associated finds on sheet map -- Geo: display lines and polygons on search - -### Bug fix ### - -- Fix safe_or template tags - -v4.0.15 - 2022-08-30 --------------------- - -### Features ### - -- "is locked" search - -### Bug fix ### -- Fix INSEE number generation on error with years -- Fix many count search such has "has-finds" - -v4.0.14 - 2022-08-05 --------------------- - -### Features ### - -- Import: manage CSV geo data - -### Bug fix ### - -- Geo sheet: fix display coordinates - -v4.0.13 - 2022-08-05 --------------------- - -### Bug fix ### - -- Imports: CSV check fix encoding check -- Imports: add post importer actions in order to manage account importer - -v4.0.12 - 2022-08-05 --------------------- - -### Bug fix ### - -- fix bug for vanilla installation (db query before db is initialized) - -v4.0.11 - 2022-08-02 --------------------- - -### Bug fix ### - -- Admin - custom form: fix form choice initialization -- File: - - Parcel form: fix town initialization - - Remove Parcel formset from wizard - - Fix modification when general contractor is missing - -v4.0.10 - 2022-07-22 --------------------- - -### Features ### - -- Admin - Custom fields: exports and imports CSV, json - -### Bug fix ### - -- Sheet document - fix permalink content -- migrate_to_geo_v4: - - fix migration of item multi_polygon_source_item and point_source_item - - fix "Contour" label - -v4.0.9 - 2022-07-21 -------------------- - -### Bug fix ### - -- Import creation: fix importer type filter - -v4.0.8 - 2022-07-18 -------------------- - -### Features ### - -- Update French translations - -v4.0.7 - 2022-07-18 -------------------- - -### Features ### - -- Operation wizard refactoring - -v4.0.6 - 2022-07-17 --------------------- - -### Bug fix ### - -- Site creation: fix post message - -v4.0.5 - 2022-07-17 --------------------- - -### Bug fix ### - -- Geo - sheet: fix coordinates display -- Account deletion: fix summary - -v4.0.4 - 2022-07-17 --------------------- - -### Features ### - -- update translations - -v4.0.3 - 2022-07-15 --------------------- - -### Bug fix ### - -- migrate_to_geo_v4: fix operation and site import when SRID != 4326 - -v4.0.2 - 2022-06-15 --------------------- - -### Bug fix ### - -- migrate_to_geo_v4: fix main item import when SRID=4326 - -v4.0.1 - 2022-06-15 --------------------- - -### Main features ### - -- Migration to Django 2.2 -- New geo item management -- Syndication of ishtar databases - -### Features ### - -- specific form for parcel management -- quick search action: grouping treatment -- better UI for imports - -### Bug fix ### - -- increase length of phone numbers +See `changelog/` dir for details.
\ No newline at end of file diff --git a/changelog/en/changelog_1.md b/changelog/en/changelog_1.md new file mode 100644 index 000000000..835bb2181 --- /dev/null +++ b/changelog/en/changelog_1.md @@ -0,0 +1,487 @@ +v4.0.44 - 2023-04-07 +-------------------- + +### Features/improvements ### +- Display of a changelog with alert display when updates are made +- Load task refactoring - manage external_id regen with tasks +- Containers: manage history +- Update and fix translations (refs #5578, refs #5579, refs #5581) +- Security: + - Manage expiration of passwords + - Manage strong password policy (ISHTAR_STRONG_PASSWORD_POLICY) with "Each character type" validator + - Add default auth validator + - Default timeout for session is set to 5 days + - Optional security for login attempt: loging, deactivate account after many failed login. + - Force using 128 bits salt for password hasher + +### Bug fixes ### +- Json fields: fix bad save of multi values +- Cascade update from warehouse to containers (refs #5432) +- Sheets: fix history view with associated geo +- Containers: remove division search +- Importer export: fix pre_importer call +- Image detail: do not display Modify link when not relevant (refs #5438) +- Fix french label for geo types (refs #5577) +- Fix permissions for treatments requests (refs #5441) + +v4.0.43 - 2023-03-17 +-------------------- + +### Features/improvements ### +- General: + - add custom cached_label configuration for each main item + - add "created" field on main items in order to facilitate queries +- settings: add "ISHTAR_SECURE_OPTIONS" to activate Django secured options +- Sheet document: better UI for files +- Model: add history for document and containers +- Menu: remove "Administration" entry - put Account management in "Directory" entry +- Admin: + - Global variable: edit in table, add import/export in CSV/JSON + - overload index to add subsection headers +- Geo: create/edit form - new openlayers version - add default IGN tiles +- Import: improve bad encoding detection +- Search: + - add created before/after field + - Operation: add "old code" field + - Find: add "remain" field (operations and sites) + - Account: add "profile type" field +- Free text search: + - use accent and unaccented string + - add french_archeo thesaurus config + - File - add "year-index" +- Maintenance scripts: delete deprecated and migrate to ishtar_maintenance +- Put a serif font for <pre> +- Sheet: + - Treatment file: add associated image and document list + +### Bug fixes ### +- Search: + - fix many excluded facet + - improve many facet query + - Document - source type is now a hierarchic search + - Context record: add identification and activity criteria +- File: filter plan action when preventive_operator is activated in profile +- Profile: + - do not display geo item list when mapping is deactivated + - custom footer message +- Explicit message on associated container deletion when a warehouse is deleted +- Administrative act: add a warning when associated item is deleted +- Imports: register automatically type models for export +- Site: quick action for creation of virtual operation from site with many operations +- UI: + - sheet header - add caret to show collapse + - show/hide password on login +- Forms: + - custom form - can add header message + - Find: remove TAQ/TPQ check + +- Sheet: + - fix treatment and file treatment sheet display (bad QR code link) + - Operation - statistics number of parcels fix + - basket: display shared with by alpha order + +v4.0.42 - 2023-01-25 +-------------------- + +### Features/improvements ### +- Sheet treatment: improve layout - add detail links +- Allow complex format for formula + +### Bug fixes ### +- Installation: fix installation script to allow custom DB PORT and DB HOST + +v4.0.41 - 2023-01-23 +-------------------- + +### Bug fixes ### +- Fix javascript filter on field + +v4.0.40 - 2023-01-22 +-------------------- + +### Features/improvements ### +- Improve some translations + +v4.0.39 - 2023-01-20 +-------------------- + +### Features/improvements ### +- Person search: salutation/title fields + +v4.0.38 - 2023-01-20 +-------------------- + +### Bug fixes ### +- PDF export: fix new line on <pre> blocks +- Sheet warehouse: prevent duplicate label + + +v4.0.37 - 2023-01-20 +-------------------- + +### Bug fixes ### +- Find search: fix discovery date search +- Sheet find/container: fix date and float format + + +v4.0.36 - 2023-01-20 +-------------------- + +### Features/improvements ### +- Sheet find refactoring +- Free search: + - "raw" index for reference (add in index whole reference and split ref) + - improve parent only search index +- Warehouse: new slug field to prevent ID change when name is changed +- Warehouse: cached town column +- Change labels + - Identifiant musée -> Numéro d'inventaire musée + - Localisation (fiche) -> Localisation géographique + - Date de découverte (exacte ou TPQ) -> Date de découverte (exacte ou début) + - Date de découverte (TAQ) -> Date de découverte (fin) + + +v4.0.35 - 2023-01-18 +-------------------- + +### Bug fixes ### +- WIP: fix types searches with * +- Imports: fix cultural attribution import +- Table: fix default sort when pk is not "id" +- Sheet: + - warehouse: fix localisation - fix data + - container: fix localisation - fix data +- Admin: container and warehouse performance + +v4.0.34 - 2023-01-13 +-------------------- + +### Bug fixes ### +- Syndication: + - sheet - fix set default permissions + - admin ApiSearchModel - fix exporter filter for Find + - sheet - fix display detail of a dict (display associated label) + - table - select/deselect all + - table - reinit headers on load + +v4.0.33 - 2023-01-12 +-------------------- + +### Features/improvements ### +- Search result - export: export only selected +- Commands: manage update search vector with maintenance script +- utils: adapt to v4 OSM relations importer +- Syndication ui: better color for external sources +- Syndication - export external sources +- Search: sort by ID by default +- UI bootstrap for stats + +### Bug fixes ### +- Fix geo finds for external sources: do not display +- Fix pinned search for external source +- Fix strange bug on statistics with criteria + +v4.0.32 - 2022-12-12 +-------------------- + +### Features/improvements ### +- Sheet: set default permissions to False +- Find sheet: do not display container information if no permission +- Image field: can use camera for mobile device +- Import value formater: can use {item} notation for format + +### Bug fixes ### +- Full text search: add "simple" config in search + +v4.0.31 - 2022-12-05 +-------------------- + +### Features/improvements ### +- Admin: importer model export +- Imports: manage defaults with "__" + +### Bug fixes ### +- Migration v4: disable M2M post treatment + +v4.0.30 - 2022-12-02 +-------------------- + +### Improvements ### +- Use supervisor instead of systemd script for celery daemon +- Forms: minor template fix + + +v4.0.29 - 2022-11-29 +-------------------- + +### Improvements ### +- Context record: add Unit to indexed search +- Import: add ActType to imported types +- Admin: small improvements on syndication + +### Bug fixes ### +- Fix redirect URL after logout +- Fix choice display - non-relevant translation is deactivated +- Minor translation fixes + + +v4.0.28 - 2022-11-18 +-------------------- + +### Improvements ### +- Admin: site profile - better form layout +- Imports: display post-process advance +- File refactoring +- Remove dead code + +### Bug fixes ### +- Fix import when no object is created and no error is caught +- Operation from file creation - fix automatic town association and parcel recopy + +v4.0.27 - 2022-11-10 +-------------------- + +## Features ## +- Improve tests +- French translation + +### Bug fix ### +- Fix m2m display for historized items + + +v4.0.26 - 2022-11-08 +-------------------- + +### Features ### +- remove deprecated x, y, z fields on main item forms + +### Bug fix ### +- Sheet find: fix map display +- Find form: fix order of decoration field + + +v4.0.25 - 2022-11-07 +-------------------- + +### Features ### +- Geodata: display first item associated as a name when no name is provided + +### Bug fix ### +- Geodata import: fix total number evaluation on imports +- Basket modification: fix wizard update + + +v4.0.24 - 2022-10-27 +-------------------- + +### Bug fix ### +- Geodata save: transactions to limit deadlocks + + +v4.0.23 - 2022-10-26 +-------------------- + +### Features ### +- Geo data: zoom to extent + +### Bug fix ### +- Geodata post save: transactions and targeted post save to limit deadlocks + +v4.0.22 - 2022-10-14 +-------------------- + +### Features ### +- Context records: Excavation technic become many-to-many + +v4.0.21 - 2022-10-14 +-------------------- + +### Features ### +- Geo: quick add geo action for context records, sites and finds +- Geo data: manage m2m association and cascade association + +### Bug fix ### + +- Geo data: fix main_geodata association test +- fix some admin pages + +v4.0.20 - 2022-10-03 +-------------------- + +### Features ### + +Geo form - redirect to source item after edit + + +v4.0.19 - 2022-09-18 +-------------------- + +Backport of v3 changes. + +v4.0.18 - 2022-09-12 +-------------------- + +### Features ### + +- Import GIS: default to 0 skip lines (for geopackage and SHP it must be 0) + +### Bug fix ### + +- Geo - migration script: more tolerant with no geo item data - main geo is poly when defined + +v4.0.17 - 2022-09-10 +-------------------- + +### Bug fix ### + +- Geo: fix zoom to the extent - fix item counts + +v4.0.16 - 2022-09-09 +-------------------- + +### Features ### + +- Geo: display associated context records and associated finds on sheet map +- Geo: display lines and polygons on search + +### Bug fix ### + +- Fix safe_or template tags + +v4.0.15 - 2022-08-30 +-------------------- + +### Features ### + +- "is locked" search + +### Bug fix ### +- Fix INSEE number generation on error with years +- Fix many count search such has "has-finds" + +v4.0.14 - 2022-08-05 +-------------------- + +### Features ### + +- Import: manage CSV geo data + +### Bug fix ### + +- Geo sheet: fix display coordinates + +v4.0.13 - 2022-08-05 +-------------------- + +### Bug fix ### + +- Imports: CSV check fix encoding check +- Imports: add post importer actions in order to manage account importer + +v4.0.12 - 2022-08-05 +-------------------- + +### Bug fix ### + +- fix bug for vanilla installation (db query before db is initialized) + +v4.0.11 - 2022-08-02 +-------------------- + +### Bug fix ### + +- Admin - custom form: fix form choice initialization +- File: + - Parcel form: fix town initialization + - Remove Parcel formset from wizard + - Fix modification when general contractor is missing + +v4.0.10 - 2022-07-22 +-------------------- + +### Features ### + +- Admin - Custom fields: exports and imports CSV, json + +### Bug fix ### + +- Sheet document - fix permalink content +- migrate_to_geo_v4: + - fix migration of item multi_polygon_source_item and point_source_item + - fix "Contour" label + +v4.0.9 - 2022-07-21 +------------------- + +### Bug fix ### + +- Import creation: fix importer type filter + +v4.0.8 - 2022-07-18 +------------------- + +### Features ### + +- Update French translations + +v4.0.7 - 2022-07-18 +------------------- + +### Features ### + +- Operation wizard refactoring + +v4.0.6 - 2022-07-17 +-------------------- + +### Bug fix ### + +- Site creation: fix post message + +v4.0.5 - 2022-07-17 +-------------------- + +### Bug fix ### + +- Geo - sheet: fix coordinates display +- Account deletion: fix summary + +v4.0.4 - 2022-07-17 +-------------------- + +### Features ### + +- update translations + +v4.0.3 - 2022-07-15 +-------------------- + +### Bug fix ### + +- migrate_to_geo_v4: fix operation and site import when SRID != 4326 + +v4.0.2 - 2022-06-15 +-------------------- + +### Bug fix ### + +- migrate_to_geo_v4: fix main item import when SRID=4326 + +v4.0.1 - 2022-06-15 +-------------------- + +### Main features ### + +- Migration to Django 2.2 +- New geo item management +- Syndication of ishtar databases + +### Features ### + +- specific form for parcel management +- quick search action: grouping treatment +- better UI for imports + +### Bug fix ### + +- increase length of phone numbers diff --git a/changelog/fr/changelog_1.md b/changelog/fr/changelog_1.md new file mode 100644 index 000000000..4e47eed56 --- /dev/null +++ b/changelog/fr/changelog_1.md @@ -0,0 +1,86 @@ +v4.0.44 - 2023-04-06 +-------------------- + +### Fonctionnalités/améliorations ### +- Affichage d'un journal des modifications avec affichage d'alerte lors de mises à jour +- Contenants : gestion de l'historique +- Sécurité: + - Gestion de l'expiration des mots de passe + - Gestion d'une politique de mot de passe fort (possibilité de forcer des classes de caractères). + - Ajout de validateurs d'authentification par défaut pour les changements de mots de passe + - Expiration de session configurée à 5 jours par défaut + - Sécurisation optionnelle (désactivé par défaut) des tentatives de connexion : traçage, blocage de compte après multiples erreurs de connexion. + +### Corrections de dysfonctionnements ### +- Champs Json : correction d'une mauvaise sauvegarde de valeurs multiples +- Fiches : correction de l'affichage de l'historique avec la géographie associée +- Contenants : suppression de la recherche par division +- Détail de l'image : ne pas afficher le lien Modifier lorsqu'il n'est pas pertinent (#5438) +- Correction du libellé français pour les types de géographie (#5577) +- Correction des permissions pour les demandes de traitements (#5441) +- Mise à jour en cascade des contenants lors de modifications des lieux de conservation + +### Technique ### +- Refactorisation des tâches de chargement - gestion de la régénération de l'identifiant externe avec les tâches +- Mise à jour et correction des traductions (#5578, #5579, #5581) +- Export d'importeur : correction de l'appel au pre_importer +- Utilisation d'une longueur de sel de 128 bits pour le hachage des mots de passe + +v4.0.43 - 2023-03-17 +-------------------- + +### Fonctionnalités/améliorations ### +- Modèle : ajout d'un historique pour les documents et les contenants +- Menu : + - Suppression de l'entrée "Administration" + - Gestion des comptes déplacé dans l'entrée "Annuaire" + - Les variables globales sont maintenant seulement éditables dans l'administration Django +- Imports : amélioration de la détection des mauvais codages de caractères +- Critères de recherche : + - Ajout du critère "créé avant/après" + - Opération : ajout du critère "ancien code" + - Opérations et sites : ajout du critère "vestiges" + - Compte : ajout du critère "type de profil" + - Unité d'enregistrement : ajout des critères "identification" et "activité" +- Recherche en texte libre : + - Amélioration de la recherche sur les chaînes accentuées + - Ajout de la configuration d'un thésaurus dédié french_archeo + - Dossier : indexation de la référence "année-index" +- Fiche : + - Document : amélioration de l'affichage pour les fichiers + - Demande de traitement : ajout d'une image associée et d'une liste de documents +- Configuration : ajout de message personnalisé en bas de page +- Message explicite sur la suppression du contenant associé lors de la suppression d'un lieu de conservation +- Acte administratif : ajout d'un avertissement lors de la suppression d'un élément associé +- Utilisation d'une police avec empattement pour les balises <pre> (utilisée notamment pour les descriptions) +- Administration Django : + - Variable globale : édition depuis le tableau, ajout de l'import/export en CSV/JSON + - Ajouter d'en-têtes de sous-section + - Imports : enregistrer automatiquement les "types de modèles" en export JSON +- Geographie : ajout des tuiles IGN par défaut +- Site : action rapide pour la création d'une opération virtuelle à partir d'un site avec de nombreuses opérations +- Interface utilisateur : + - en-tête de fiche - ajout d'une flèche pour signifier la possibilité de replier la fiche + - bouton pour afficher/masquer le mot de passe lors de la connexion +- Formulaires : + - formulaire personnalisé - possibilité d'ajouter un message d'en-tête + +### Corrections de dysfonctionnements ### +- Recherche : + - Correction de recherche par critères (en particulier recherche en exclusion et recherche cumulant plusieurs critères) + - Document : le type de source est maintenant une recherche hiérarchique +- Formulaire mobilier : suppression de la vérification de cohérence TAQ/TPQ +- Fiche : + - ne pas afficher la liste des éléments géographiques lorsque la cartographie est désactivée + - Traitement, demande de traitement : correction de l'affichage (mauvais lien avec le QR-code) + - Opération : correction des statistiques sur le nombre de parcelles + - Panier : affichage des partages par ordre alphabétiques +- Dossier : retrait de l'action d'édition du plan d'intervention lorsque le module "opérateur préventif" est désactivé dans le profil + +### Technique ### +- Général : + - ajout d'une configuration personnalisée de libellé en cache pour chaque élément principal + - ajout d'un champ "créé" sur les éléments principaux afin de faciliter les requêtes +- Paramètres : ajout de "ISHTAR_SECURE_OPTIONS" pour activer les options sécurisées de Django +- Geographie : nouvelle version openlayers +- Scripts de maintenance : suppression des scripts obsolètes et migration vers ishtar_maintenance diff --git a/example_project/settings.py b/example_project/settings.py index 5f110acad..ed70a6b59 100644 --- a/example_project/settings.py +++ b/example_project/settings.py @@ -32,6 +32,7 @@ DISABLE_TASK_TIMEOUT = True CACHE_TASK_TIMEOUT = 4 CACHE_SMALLTIMEOUT = 60 CACHE_TIMEOUT = 3600 +CACHE_LONGTIMEOUT = 3600 * 6 CACHE_BACKEND = "memcached://127.0.0.1:11211/" SEP = os.path.sep @@ -326,6 +327,7 @@ SENTRY_ID = None DISTRIBUTION = "source" LIB_BASE_PATH = ROOT_PATH + "../" FIXTURE_AUTH_PATH = ROOT_PATH + "../" +SHARE_BASE_PATH = FIXTURE_AUTH_PATH AUTH_PASSWORD_VALIDATORS = [] diff --git a/ishtar_common/context_processors.py b/ishtar_common/context_processors.py index c1d1224ea..8131e0382 100644 --- a/ishtar_common/context_processors.py +++ b/ishtar_common/context_processors.py @@ -18,6 +18,8 @@ # See the file COPYING for details. import datetime +import os +import re from django.conf import settings from django.core.cache import cache @@ -33,6 +35,45 @@ from bootstrap_datepicker.widgets import DatePicker from .menus import Menu +def _get_changelog_version_from_file(): + changelog_dir = os.path.join( + settings.SHARE_BASE_PATH, + "changelog", + settings.LANGUAGE_CODE.split('-')[0] + ) + if not os.path.exists(changelog_dir): + return "no-version" + changelog_file = os.path.join(changelog_dir, f"changelog_1.md") + if not os.path.exists(changelog_file): + return "no-version" + current_version = None + with open(changelog_file, "r") as changelog: + for line in changelog.readlines(): + m = re.match(r"v(\d+)\.(\d+)\.(\d+)", line) + if not m: + continue + g = m.groups() + if len(g) != 3: + continue + current_version = ".".join(g) + break + if not current_version: + return "no-version" + return current_version + + +def get_changelog_version(): + cache_key = f"{settings.PROJECT_SLUG}-news-version" + current_version = cache.get(cache_key) + if current_version: + return current_version + + if not current_version: + current_version = _get_changelog_version_from_file() + cache.set(cache_key, current_version, settings.CACHE_LONGTIMEOUT) + return current_version + + def get_base_context(request): dct = { "URL_PATH": settings.URL_PATH, @@ -83,15 +124,36 @@ def get_base_context(request): cache.set(key, password_expired, settings.CACHE_TIMEOUT) if password_expired and not request.path.endswith("password_change/"): msg = str(_("Your password has expired. Please update it using this " - "form.")) + "<form>.")) msg = msg.replace( - str(_("form")), + "<form>", f'<a href="{reverse("password_change")}">' - f'<i class="fa fa-external-link" aria-hidden="true"></i> ' - f'{_("form")}</a>' + f'{_("form")} ' + f'<i class="fa fa-external-link" aria-hidden="true"></i>' + '</a>' ) dct["MESSAGES"].append((msg, "warning")) + # check changelog + if request.user.ishtaruser.display_news: + user_version = request.user.ishtaruser.latest_news_version + current_version = get_changelog_version() + if current_version != user_version and "changelog" not in dct["CURRENT_PATH"]: + if user_version: + msg = str(_("Ishtar have been updated from version <old-version> to <new-version>. " + "Check the <changelog>.")) + else: + msg = str(_("Ishtar have been updated to version <new-version>. Check the " + "<changelog>.")) + msg = msg.replace( + "<changelog>", + f'<a href="{reverse("changelog")}">' + f'{_("changelog")} ' + f'<i class="fa fa-external-link" aria-hidden="true"></i>' + f'</a>' + ).replace("<old-version>", user_version).replace("<new-version>", current_version) + dct["MESSAGES"].append((msg, "info")) + # external sources if ( request.user.ishtaruser.current_profile diff --git a/ishtar_common/migrations/0227_auto_20230404_1112.py b/ishtar_common/migrations/0227_auto_20230406_1834.py index 1ba74f292..a365c0bc8 100644 --- a/ishtar_common/migrations/0227_auto_20230404_1112.py +++ b/ishtar_common/migrations/0227_auto_20230406_1834.py @@ -1,4 +1,4 @@ -# Generated by Django 2.2.24 on 2023-04-04 11:12 +# Generated by Django 2.2.24 on 2023-04-06 18:34 import datetime from django.db import migrations, models @@ -13,6 +13,16 @@ class Migration(migrations.Migration): operations = [ migrations.AddField( model_name='ishtaruser', + name='display_news', + field=models.BooleanField(default=True, verbose_name='Display news'), + ), + migrations.AddField( + model_name='ishtaruser', + name='latest_news_version', + field=models.CharField(blank=True, default='', max_length=20, verbose_name='Latest news version'), + ), + migrations.AddField( + model_name='ishtaruser', name='password_last_update', field=models.DateField(default=datetime.date.today, verbose_name='Password last update'), ), diff --git a/ishtar_common/models.py b/ishtar_common/models.py index efa061431..f7baebfe4 100644 --- a/ishtar_common/models.py +++ b/ishtar_common/models.py @@ -3416,6 +3416,10 @@ class IshtarUser(FullSearch): advanced_shortcut_menu = models.BooleanField( _("Advanced shortcut menu"), default=False ) + # latest news read by the user + latest_news_version = models.CharField(_("Latest news version"), default="", blank=True, + max_length=20) + display_news = models.BooleanField(_("Display news"), default=True) class Meta: verbose_name = _("Ishtar user") @@ -3500,7 +3504,7 @@ class IshtarUser(FullSearch): @post_importer_action def import_create_profile(self, context, value): UserProfile.objects.get_or_create(person=self.person, profile_type=value, - defaults={"name":value.label}) + defaults={"name": value.label}) post_save.connect(cached_label_changed, sender=IshtarUser) diff --git a/ishtar_common/templates/ishtar/changelog.html b/ishtar_common/templates/ishtar/changelog.html new file mode 100644 index 000000000..e8fb94ea8 --- /dev/null +++ b/ishtar_common/templates/ishtar/changelog.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} +{% load i18n %} +{% block content %} +<div class="container"> + <h1>{% trans "Changelog" %}</h1> + {% if next %} + <div class="text-center"> + <a class="btn btn-info" href="{% url 'changelog' next %}">{% trans "Next" %}</a> + </div> + {% endif %} + {{changelog|safe}} + {% if previous %} + <div class="text-center"> + <a class="btn btn-info" href="{% url 'changelog' previous %}">{% trans "Previous" %}</a> + </div> + {% endif %} +</div> +{% endblock %} diff --git a/ishtar_common/templates/navbar.html b/ishtar_common/templates/navbar.html index d8e368bbc..3e7190645 100644 --- a/ishtar_common/templates/navbar.html +++ b/ishtar_common/templates/navbar.html @@ -33,6 +33,9 @@ <a class="dropdown-item" href="{% url 'password_change' %}"> {% trans "Change password" %} </a> + <a class="dropdown-item" href="{% url 'changelog' %}"> + {% trans "Changelog" %} + </a> <a class="dropdown-item" href="{% url 'logout' %}"> {% trans "Log out" %} </a> diff --git a/ishtar_common/tests.py b/ishtar_common/tests.py index 774fab2a2..97002f13d 100644 --- a/ishtar_common/tests.py +++ b/ishtar_common/tests.py @@ -1348,9 +1348,9 @@ class UserProfileTest(TestCase): self.user.set_password(self.password) self.user.save() self.client = Client() - self.client.login(username=self.username, password=self.password) def test_profile_edit(self): + self.client.login(username=self.username, password=self.password) base_url = "/profile/" base_profile = self.user.ishtaruser.current_profile response = self.client.get(base_url) @@ -1407,6 +1407,52 @@ class UserProfileTest(TestCase): self.assertEqual(self.user.ishtaruser.person.profiles.count(), 1) + def _check_changelog_alert(self, content, check_ok=True): + soup = Soup(content, "lxml") + messages = soup.findAll("div", {"id": "message_list"}) + if not check_ok and not len(messages): + return + self.assertEqual(len(messages), 1) + for div in messages: + content = str(div.extract()) + if check_ok: + self.assertIn("/changelog/", content) + else: + self.assertNotIn("/changelog/", content) + + def test_changelog(self): + url = "/changelog/" + response = self.client.get(url) + self.assertRedirects(response, "/accounts/login/?next={}".format(url)) + self.client.login(username=self.username, password=self.password) + user = models.IshtarUser.objects.get(pk=self.user.pk) + self.assertEqual(user.latest_news_version, "") + user.display_news = False + user.save() + + response = self.client.get("/") + self.assertEqual(response.status_code, 200) + response = self.client.get("/") + # 2 times because the first page on server start do not have the version in cache + # not a big deal at all... + + # display_news set to False + self._check_changelog_alert(response.content.decode(), check_ok=False) + user.display_news = True + user.save() + response = self.client.get("/") + self._check_changelog_alert(response.content.decode()) + + response = self.client.get(url) + self.assertEqual(response.status_code, 200) + user = models.IshtarUser.objects.get(pk=self.user.pk) + # checked version updated + self.assertNotEqual(user.latest_news_version, "") + # now no link to changelog displayed + response = self.client.get("/") + self._check_changelog_alert(response.content.decode(), check_ok=False) + + class AcItem: def __init__( self, diff --git a/ishtar_common/urls.py b/ishtar_common/urls.py index c5b3816a4..ad7e22019 100644 --- a/ishtar_common/urls.py +++ b/ishtar_common/urls.py @@ -422,8 +422,7 @@ urlpatterns += [ views.autocomplete_organization, name="autocomplete-organization", ), - # TODO v4: suppression - #url(r"admin-globalvar/", views.GlobalVarEdit.as_view(), name="admin-globalvar"), + url(r"changelog/(?:(?P<page>\d+)/)?", views.ChangelogView.as_view(), name="changelog"), url(r"person-merge/(?:(?P<page>\d+)/)?$", views.person_merge, name="person_merge"), url( r"person-manual-merge/$", diff --git a/ishtar_common/views.py b/ishtar_common/views.py index f5a58afad..ac4e995d1 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -24,6 +24,7 @@ from jinja2 import TemplateSyntaxError import json import logging import os +import re import unicodedata import urllib.parse @@ -1115,11 +1116,11 @@ organization_merge = merge_action( ) -class IshtarMixin(object): +class IshtarMixin: page_name = "" def get_context_data(self, **kwargs): - context = super(IshtarMixin, self).get_context_data(**kwargs) + context = super().get_context_data(**kwargs) context["page_name"] = self.page_name return context @@ -1149,6 +1150,51 @@ class AdminLoginRequiredMixin(LoginRequiredMixin): return super(AdminLoginRequiredMixin, self).dispatch(request, *args, **kwargs) +class ChangelogView(IshtarMixin, LoginRequiredMixin, TemplateView): + template_name = "ishtar/changelog.html" + page_name = _("Changelog") + current_url = "changelog" + + def update_read_version(self): + if not self.request.user or not hasattr(self.request.user, "ishtaruser") \ + or not self.request.user.ishtaruser: + return + cache_key = f"{settings.PROJECT_SLUG}-news-version" + current_version = cache.get(cache_key) + if not current_version: + return + ishtar_user = models.IshtarUser.objects.get(pk=self.request.user.ishtaruser.pk) + if not ishtar_user.latest_news_version \ + or ishtar_user.latest_news_version != current_version: + ishtar_user.latest_news_version = current_version + ishtar_user.save() + + def get_context_data(self, **kwargs): + context = super().get_context_data(**kwargs) + changelog_dir = os.path.join( + settings.SHARE_BASE_PATH, + "changelog", + settings.LANGUAGE_CODE.split('-')[0] + ) + if not os.path.exists(changelog_dir): + raise Http404() + page_number = int(kwargs.get("page", 0) or 0) or 1 + if page_number == 1: + self.update_read_version() + changelog_file = os.path.join(changelog_dir, f"changelog_{page_number}.md") + if not os.path.exists(changelog_file): + raise Http404() + with open(changelog_file, "r") as changelog: + context["changelog"] = markdown(changelog.read()) + if page_number > 1: + context["next"] = page_number - 1 + + changelog_file_next = os.path.join(changelog_dir, f"changelog_{page_number + 1}.md") + if os.path.exists(changelog_file_next): + context["previous"] = page_number + 1 + return context + + class ProfileEdit(LoginRequiredMixin, FormView): template_name = "ishtar/forms/profile.html" form_class = forms.ProfilePersonForm |