mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Make assignment priority a required field
This commit is contained in:
@ -52,6 +52,14 @@ IPADDRESS_ROLES_NONUNIQUE = (
|
||||
)
|
||||
|
||||
|
||||
#
|
||||
# FHRP groups
|
||||
#
|
||||
|
||||
FHRPGROUPASSIGNMENT_PRIORITY_MIN = 0
|
||||
FHRPGROUPASSIGNMENT_PRIORITY_MAX = 255
|
||||
|
||||
|
||||
#
|
||||
# VLANs
|
||||
#
|
||||
|
@ -1,4 +1,5 @@
|
||||
import django.core.serializers.json
|
||||
import django.core.validators
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
import taggit.managers
|
||||
@ -44,7 +45,7 @@ class Migration(migrations.Migration):
|
||||
('last_updated', models.DateTimeField(auto_now=True, null=True)),
|
||||
('id', models.BigAutoField(primary_key=True, serialize=False)),
|
||||
('object_id', models.PositiveIntegerField()),
|
||||
('priority', models.PositiveSmallIntegerField(blank=True, null=True)),
|
||||
('priority', models.PositiveSmallIntegerField(validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(255)])),
|
||||
('content_type', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype')),
|
||||
('group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ipam.fhrpgroup')),
|
||||
],
|
||||
|
@ -1,11 +1,13 @@
|
||||
from django.contrib.contenttypes.fields import GenericForeignKey, GenericRelation
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||
from django.db import models
|
||||
from django.urls import reverse
|
||||
|
||||
from extras.utils import extras_features
|
||||
from netbox.models import ChangeLoggedModel, PrimaryModel
|
||||
from ipam.choices import *
|
||||
from ipam.constants import *
|
||||
from utilities.querysets import RestrictedQuerySet
|
||||
|
||||
__all__ = (
|
||||
@ -81,8 +83,10 @@ class FHRPGroupAssignment(ChangeLoggedModel):
|
||||
on_delete=models.CASCADE
|
||||
)
|
||||
priority = models.PositiveSmallIntegerField(
|
||||
blank=True,
|
||||
null=True
|
||||
validators=(
|
||||
MinValueValidator(FHRPGROUPASSIGNMENT_PRIORITY_MIN),
|
||||
MaxValueValidator(FHRPGROUPASSIGNMENT_PRIORITY_MAX)
|
||||
)
|
||||
)
|
||||
|
||||
objects = RestrictedQuerySet.as_manager()
|
||||
|
Reference in New Issue
Block a user