From af04b1ecfc22f8c104f6f960c26086c4284e9777 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Fri, 20 Jan 2023 11:46:57 +0100 Subject: Warehouse: new slug field to prevent ID change when name is changed --- archaeological_warehouse/forms.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'archaeological_warehouse/forms.py') diff --git a/archaeological_warehouse/forms.py b/archaeological_warehouse/forms.py index 828d651f1..a95289669 100644 --- a/archaeological_warehouse/forms.py +++ b/archaeological_warehouse/forms.py @@ -23,6 +23,7 @@ import datetime from django import forms from django.db.models import Max from django.conf import settings +from django.core.validators import validate_slug from django.forms.formsets import formset_factory from ishtar_common.utils import ugettext_lazy as _ @@ -201,6 +202,9 @@ class WarehouseForm(CustomForm, ManageOldType, forms.Form): } name = forms.CharField(label=_("Name"), max_length=200, validators=[name_validator]) + slug = forms.CharField(label=_("Textual ID"), max_length=200, + validators=[validate_slug], required=False, + help_text=_("Auto filled if kept empty.")) warehouse_type = forms.ChoiceField(label=_("Warehouse type"), choices=[]) organization = forms.IntegerField( label=_("Organization"), -- cgit v1.2.3