diff --git a/src/servala/frontend/forms/organization.py b/src/servala/frontend/forms/organization.py index 41cc26c..d582ce9 100644 --- a/src/servala/frontend/forms/organization.py +++ b/src/servala/frontend/forms/organization.py @@ -1,4 +1,6 @@ +from django import forms from django.forms import ModelForm +from django.utils.translation import gettext_lazy as _ from servala.core.models import Organization from servala.frontend.forms.mixins import HtmxMixin @@ -7,4 +9,19 @@ from servala.frontend.forms.mixins import HtmxMixin class OrganizationForm(HtmxMixin, ModelForm): class Meta: model = Organization - fields = ("name",) + fields = ("name", "namespace") + widgets = { + "namespace": forms.TextInput( + attrs={ + "pattern": "[a-z0-9]([-a-z0-9]*[a-z0-9])?", + "title": _( + 'Lowercase alphanumeric characters or "-", must start and end with alphanumeric' + ), + } + ) + } + help_texts = { + "namespace": _( + "This namespace will be used for all resources and cannot be changed later." + ) + }