mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 09:26:03 +00:00
fix(tags): at most 12 characters; "…" does not move the columns
- A new or renamed tag has at most 12 characters (computes.models.TAG_LENGTH, a validator: the column keeps 32, so names made before the limit stay usable until renamed and the migration changes no SQL); the tag box offers no longer name. - The tags "…" shows in a table's cell go below the others within the cell's width as it is, so the list's columns no longer move.
This commit is contained in:
parent
0e711ec058
commit
bc1894e4d8
12 changed files with 115 additions and 78 deletions
|
|
@ -3,7 +3,7 @@ from django.db import transaction
|
|||
from django.utils.translation import gettext_lazy as _
|
||||
from vrtManager.connection import CONN_SOCKET, CONN_SSH, CONN_TCP, CONN_TLS
|
||||
|
||||
from computes.models import TAG_NAME, Compute, Tag
|
||||
from computes.models import TAG_LENGTH, TAG_NAME, Compute, Tag
|
||||
from computes.utils import lock_ownership
|
||||
|
||||
from .validators import validate_hostname
|
||||
|
|
@ -60,9 +60,10 @@ class TagsField(forms.Field):
|
|||
return set(self.to_python(initial)) != set(self.to_python(data))
|
||||
|
||||
def validate(self, value):
|
||||
existing = set(Tag.objects.filter(name__in=value).values_list("name", flat=True))
|
||||
for name in value:
|
||||
if len(name) > 32:
|
||||
raise forms.ValidationError(_("A tag has at most 32 characters"))
|
||||
if name not in existing: # a tag made before the limit can still be given
|
||||
TAG_LENGTH(name)
|
||||
TAG_NAME(name)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue