2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-06-18 13:05:42 +00:00

Remove special characters restriction in category names (#3370)

* [FR]Special characters restriction in category names
Fixes #3358

* remove old validation test
This commit is contained in:
Matthias Mair
2022-07-21 03:33:21 +02:00
committed by GitHub
parent aca58dedc0
commit 09987ad79b
5 changed files with 37 additions and 20 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 3.2.14 on 2022-07-20 16:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('part', '0080_alter_part_image'),
]
operations = [
migrations.AlterField(
model_name='partcategory',
name='name',
field=models.CharField(help_text='Name', max_length=100, verbose_name='Name'),
),
]

View File

@ -1,6 +1,5 @@
"""Unit tests for the PartCategory model"""
from django.core.exceptions import ValidationError
from django.test import TestCase
from .models import Part, PartCategory, PartParameter, PartParameterTemplate
@ -109,19 +108,6 @@ class CategoryTest(TestCase):
part_parameter.pop(item)
self.assertEqual(len(part_parameter), 1)
def test_invalid_name(self):
"""Test that an illegal character is prohibited in a category name"""
cat = PartCategory(name='test/with/illegal/chars', description='Test category', parent=None)
with self.assertRaises(ValidationError) as err:
cat.full_clean()
cat.save() # pragma: no cover
self.assertIn('Illegal character in name', str(err.exception.error_dict.get('name')))
cat.name = 'good name'
cat.save()
def test_delete(self):
"""Test that category deletion moves the children properly."""
# Delete the 'IC' category and 'Transceiver' should move to be under 'Electronics'