mirror of
https://github.com/inventree/InvenTree.git
synced 2025-06-16 12:05:53 +00:00
Add validation to part units field
This commit is contained in:
19
InvenTree/part/migrations/0110_alter_part_units.py
Normal file
19
InvenTree/part/migrations/0110_alter_part_units.py
Normal file
@ -0,0 +1,19 @@
|
||||
# Generated by Django 3.2.19 on 2023-05-19 03:31
|
||||
|
||||
import InvenTree.validators
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('part', '0109_auto_20230517_1048'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='part',
|
||||
name='units',
|
||||
field=models.CharField(blank=True, default='', help_text='Units of measure for this part', max_length=20, null=True, validators=[InvenTree.validators.validate_physical_units], verbose_name='Units'),
|
||||
),
|
||||
]
|
@ -984,6 +984,9 @@ class Part(InvenTreeBarcodeMixin, InvenTreeNotesMixin, MetadataMixin, MPTTModel)
|
||||
blank=True, null=True,
|
||||
verbose_name=_('Units'),
|
||||
help_text=_('Units of measure for this part'),
|
||||
validators=[
|
||||
validators.validate_physical_units,
|
||||
]
|
||||
)
|
||||
|
||||
assembly = models.BooleanField(
|
||||
|
Reference in New Issue
Block a user