summaryrefslogtreecommitdiff
path: root/archaeological_operations
diff options
context:
space:
mode:
Diffstat (limited to 'archaeological_operations')
-rw-r--r--archaeological_operations/forms.py6
-rw-r--r--archaeological_operations/migrations/0118_operator_reference_length.py29
-rw-r--r--archaeological_operations/models.py5
3 files changed, 36 insertions, 4 deletions
diff --git a/archaeological_operations/forms.py b/archaeological_operations/forms.py
index b37bed988..6b0959a91 100644
--- a/archaeological_operations/forms.py
+++ b/archaeological_operations/forms.py
@@ -531,8 +531,8 @@ class OperationSelect(GeoItemSelect):
args=[organization_type_pks_lazy(['operator'])]),
associated_model=Organization),
validators=[valid_id(Organization)])
- # operator_reference = forms.CharField(label=_("Operator reference"),
- # max_length=20)
+ operator_reference = forms.CharField(label=_("Operator reference"),
+ max_length=200)
remains = forms.ChoiceField(label=_("Remains"), choices=[])
periods = forms.ChoiceField(label=_("Periods"), choices=[])
start_before = DateField(label=_("Started before"))
@@ -772,7 +772,7 @@ class OperationFormGeneral(CustomForm, ManageOldType):
associated_model=Organization, new=True),
validators=[valid_id(Organization)], required=False)
operator_reference = forms.CharField(label=_("Operator reference"),
- required=False, max_length=20)
+ required=False, max_length=200)
in_charge = forms.IntegerField(
label=_("Scientific monitor"),
widget=widgets.JQueryAutoComplete(
diff --git a/archaeological_operations/migrations/0118_operator_reference_length.py b/archaeological_operations/migrations/0118_operator_reference_length.py
new file mode 100644
index 000000000..875d7a442
--- /dev/null
+++ b/archaeological_operations/migrations/0118_operator_reference_length.py
@@ -0,0 +1,29 @@
+# Generated by Django 2.2.24 on 2024-06-06 16:09
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('archaeological_operations', '0117_data_migration_culturalattributiontype'),
+ ]
+
+ operations = [
+ migrations.RunSQL(
+ "UPDATE archaeological_operations_operation SET operator_reference='' WHERE operator_reference IS NULL;"
+ ),
+ migrations.RunSQL(
+ "UPDATE archaeological_operations_historicaloperation SET operator_reference='' WHERE operator_reference IS NULL;"
+ ),
+ migrations.AlterField(
+ model_name='historicaloperation',
+ name='operator_reference',
+ field=models.CharField(blank=True, default='', max_length=200, verbose_name='Operator reference'),
+ ),
+ migrations.AlterField(
+ model_name='operation',
+ name='operator_reference',
+ field=models.CharField(blank=True, default='', max_length=200, verbose_name='Operator reference'),
+ ),
+ ]
diff --git a/archaeological_operations/models.py b/archaeological_operations/models.py
index be2af0d1a..333128c06 100644
--- a/archaeological_operations/models.py
+++ b/archaeological_operations/models.py
@@ -1208,6 +1208,9 @@ class Operation(
"comment": SearchAltName(
pgettext_lazy("key for text search", "comment"), "comment__iexact"
),
+ "operator_reference": SearchAltName(
+ pgettext_lazy("key for text search", "operator-reference"), "operator_reference__iexact"
+ ),
"abstract": SearchAltName(
pgettext_lazy("key for text search", "abstract"), "abstract__iexact"
),
@@ -1462,7 +1465,7 @@ class Operation(
)
## end fr
operator_reference = models.CharField(
- _("Operator reference"), max_length=20, null=True, blank=True
+ _("Operator reference"), max_length=200, blank=True, default=""
)
common_name = models.TextField(_("Generic name"), blank=True, default="")
address = models.TextField(_("Address / Locality"), blank=True, default="")