summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-03-05 12:46:54 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2024-04-16 16:43:02 +0200
commita02dc5dbafe7c17060e392e38dfc23f09bf3e73b (patch)
tree245597524d94151dd512aeb8c4923680f4eed353
parentac2ab25b6b85866c6d8076be111b73af27e3fec2 (diff)
downloadIshtar-a02dc5dbafe7c17060e392e38dfc23f09bf3e73b.tar.bz2
Ishtar-a02dc5dbafe7c17060e392e38dfc23f09bf3e73b.zip
🐛 fix main image for files (refs #5789)
-rw-r--r--archaeological_files/migrations/0114_main_image.py25
-rw-r--r--archaeological_files/models.py8
-rw-r--r--changelog/en/changelog_2022-06-15.md1
-rw-r--r--changelog/fr/changelog_2023-01-25.md1
-rw-r--r--ishtar_common/templates/ishtar/sheet_document.html2
5 files changed, 36 insertions, 1 deletions
diff --git a/archaeological_files/migrations/0114_main_image.py b/archaeological_files/migrations/0114_main_image.py
new file mode 100644
index 000000000..bd586e139
--- /dev/null
+++ b/archaeological_files/migrations/0114_main_image.py
@@ -0,0 +1,25 @@
+# Generated by Django 2.2.24 on 2024-03-05 12:33
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('ishtar_common', '0239_shootingangle_parent'),
+ ('archaeological_files', '0113_file_imports_updated'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='file',
+ name='main_image',
+ field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='main_image_files', to='ishtar_common.Document', verbose_name='Main image'),
+ ),
+ migrations.AddField(
+ model_name='historicalfile',
+ name='main_image',
+ field=models.ForeignKey(blank=True, db_constraint=False, null=True, on_delete=django.db.models.deletion.DO_NOTHING, related_name='+', to='ishtar_common.Document', verbose_name='Main image'),
+ ),
+ ]
diff --git a/archaeological_files/models.py b/archaeological_files/models.py
index 1f2298b32..264773c1b 100644
--- a/archaeological_files/models.py
+++ b/archaeological_files/models.py
@@ -730,6 +730,14 @@ class File(
documents = models.ManyToManyField(
Document, related_name="files", verbose_name=_("Documents"), blank=True
)
+ main_image = models.ForeignKey(
+ Document,
+ related_name="main_image_files",
+ on_delete=models.SET_NULL,
+ verbose_name=_("Main image"),
+ blank=True,
+ null=True,
+ )
imported_line = models.TextField(_("Imported line"), blank=True, default="")
history = HistoricalRecords(bases=[HistoryModel])
diff --git a/changelog/en/changelog_2022-06-15.md b/changelog/en/changelog_2022-06-15.md
index a036eb22c..0f8a567bf 100644
--- a/changelog/en/changelog_2022-06-15.md
+++ b/changelog/en/changelog_2022-06-15.md
@@ -62,6 +62,7 @@ v4.0.XX - 2099-12-31
- context record relations graph - fix '\n' string (#5500)
- fix consultation permissions on the contents of a container (#5767)
- fix default settings for treatment states and treatments types (#5782, #5774)
+- fix main image for files (#5789)
v4.0.75 - 2024-04-16
--------------------
diff --git a/changelog/fr/changelog_2023-01-25.md b/changelog/fr/changelog_2023-01-25.md
index d1ffeb6d5..064da42f4 100644
--- a/changelog/fr/changelog_2023-01-25.md
+++ b/changelog/fr/changelog_2023-01-25.md
@@ -63,6 +63,7 @@ v4.0.XX - 2099-12-31
- graphe de relations entre unité d'enregistrements - correction du caractère '\n' (#5500)
- correction des droits de consultation sur le contenu d'un contenant (#5767)
- correction de paramétrage par défaut des types de traitements et des états de traitements (#5782, #5774)
+- correction de l'image principale pour les dossiers (#5789)
v4.0.75 - 2024-04-16
--------------------
diff --git a/ishtar_common/templates/ishtar/sheet_document.html b/ishtar_common/templates/ishtar/sheet_document.html
index 4a52be1ba..258243a24 100644
--- a/ishtar_common/templates/ishtar/sheet_document.html
+++ b/ishtar_common/templates/ishtar/sheet_document.html
@@ -121,7 +121,7 @@
{% block related %}
{% if item.has_related %}
<h3>{% trans "Related items" %}</h3>
-{% field_flex_full "Files" item.files|add_links %}
+{% field_flex_full _("Files") item.files|add_links %}
{% field_flex_full "Administrative acts" item.administrativeacts|add_links %}
{% field_flex_full "Sites" item.sites|add_links %}
{% field_flex_full "Operations" item.operations|add_links %}