summaryrefslogtreecommitdiff
path: root/ishtar_common
diff options
context:
space:
mode:
authorÉtienne Loks <etienne.loks@iggdrasil.net>2024-11-28 17:09:34 +0100
committerÉtienne Loks <etienne.loks@iggdrasil.net>2025-02-19 14:45:56 +0100
commit85108e2ecf8fd38453e5ac0cb7a25d1c169cdb3b (patch)
treef508182f5ec001d868d8ad0ae55848ac8595aafb /ishtar_common
parent80c491d145cad911099c88fb1bc10d1bd4b6db9b (diff)
downloadIshtar-85108e2ecf8fd38453e5ac0cb7a25d1c169cdb3b.tar.bz2
Ishtar-85108e2ecf8fd38453e5ac0cb7a25d1c169cdb3b.zip
✨ site profile: ability to set default localisation for treatments
Diffstat (limited to 'ishtar_common')
-rw-r--r--ishtar_common/admin.py3
-rw-r--r--ishtar_common/migrations/0259_ishtarsiteprofile_default_location_for_treatment.py20
-rw-r--r--ishtar_common/models.py14
3 files changed, 35 insertions, 2 deletions
diff --git a/ishtar_common/admin.py b/ishtar_common/admin.py
index 909421188..6fda81283 100644
--- a/ishtar_common/admin.py
+++ b/ishtar_common/admin.py
@@ -565,7 +565,7 @@ class IshtarSiteProfileAdmin(admin.ModelAdmin):
)
model = models.IshtarSiteProfile
form = AdminIshtarSiteProfileForm
- autocomplete_fields = ["no_context_button"]
+ autocomplete_fields = ["no_context_button", "default_location_for_treatment"]
fieldsets = (
(None, {
"fields": (
@@ -631,6 +631,7 @@ class IshtarSiteProfileAdmin(admin.ModelAdmin):
"relation_graph",
"parcel_mandatory",
"no_context_button",
+ "default_location_for_treatment",
),
}),
(_("Index"), {
diff --git a/ishtar_common/migrations/0259_ishtarsiteprofile_default_location_for_treatment.py b/ishtar_common/migrations/0259_ishtarsiteprofile_default_location_for_treatment.py
new file mode 100644
index 000000000..7baf9eada
--- /dev/null
+++ b/ishtar_common/migrations/0259_ishtarsiteprofile_default_location_for_treatment.py
@@ -0,0 +1,20 @@
+# Generated by Django 2.2.24 on 2024-11-28 15:44
+
+from django.db import migrations, models
+import django.db.models.deletion
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_warehouse', '0123_warehouse_container_ishtar_users'),
+ ('ishtar_common', '0258_rename_perm_query'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='ishtarsiteprofile',
+ name='default_location_for_treatment',
+ field=models.ForeignKey(blank=True, help_text='If provided treatment forms have by default a location provided.', null=True, on_delete=django.db.models.deletion.SET_NULL, to='archaeological_warehouse.Warehouse', verbose_name='Default location for treatments'),
+ ),
+ ]
diff --git a/ishtar_common/models.py b/ishtar_common/models.py
index 2f103ab06..dc3c5d29a 100644
--- a/ishtar_common/models.py
+++ b/ishtar_common/models.py
@@ -1166,7 +1166,19 @@ class IshtarSiteProfile(models.Model, Cached):
no_context_button = models.ForeignKey(
"archaeological_context_records.ContextRecord",
verbose_name=_("Context record for no context button"),
- help_text=_('If provided a button is displayed on find add page to create a "No context" find'),
+ help_text=_('If provided, a button is displayed on find add page to '
+ 'create a "No context" find'),
+ on_delete=models.SET_NULL,
+ null=True,
+ blank=True
+ )
+ default_location_for_treatment = models.ForeignKey(
+ "archaeological_warehouse.Warehouse",
+ verbose_name=_("Default location for treatments"),
+ help_text=_("If provided, treatment forms have by default this "
+ "location set. Furthermore if this location has "
+ "an organization attached, this organization is set "
+ "by default."),
on_delete=models.SET_NULL,
null=True,
blank=True