mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #609: Add min/max value and regex validation for custom fields
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
import django.contrib.postgres.fields
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
import utilities.validators
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
@ -38,4 +40,20 @@ class Migration(migrations.Migration):
|
||||
old_name='obj_type',
|
||||
new_name='content_types',
|
||||
),
|
||||
# Add validation fields
|
||||
migrations.AddField(
|
||||
model_name='customfield',
|
||||
name='validation_maximum',
|
||||
field=models.PositiveIntegerField(blank=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customfield',
|
||||
name='validation_minimum',
|
||||
field=models.PositiveIntegerField(blank=True, null=True),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='customfield',
|
||||
name='validation_regex',
|
||||
field=models.CharField(blank=True, max_length=500, validators=[utilities.validators.validate_regex]),
|
||||
),
|
||||
]
|
||||
|
Reference in New Issue
Block a user