1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +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:
catborise 2026-11-19 09:34:07 +03:00
parent 0e711ec058
commit bc1894e4d8
12 changed files with 115 additions and 78 deletions

View file

@ -23,7 +23,11 @@ class TagsFieldTests(TestCase):
self.assertEqual(TagsField().clean(["Prod", "db", "prod"]), ["prod", "db"])
def test_a_name_is_letters_digits_and_dot_dash_underscore(self):
for bad in ("two words", "-lead", "ç", "x" * 33):
self.assertEqual(TagsField().clean(["x" * 12]), ["x" * 12])
# a tag made before the limit can still be given
Tag.objects.create(name="y" * 20)
self.assertEqual(TagsField().clean(["y" * 20]), ["y" * 20])
for bad in ("two words", "-lead", "ç", "x" * 13):
with self.subTest(bad), self.assertRaises(forms.ValidationError):
TagsField().clean([bad])