Add namespace to organization create
This commit is contained in:
parent
b8e9875772
commit
0d47060141
1 changed files with 18 additions and 1 deletions
|
@ -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."
|
||||
)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue