Add namespace to organization create

This commit is contained in:
Tobias Kunze 2025-03-27 15:16:53 +01:00
parent b8e9875772
commit 0d47060141

View file

@ -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."
)
}