Fixes: #3318 - Increases length of platform name and slug to 64 characters (#3353)

This commit is contained in:
Daniel Sheppard 2019-09-06 13:01:27 -05:00 committed by GitHub
parent 9c6dbd7337
commit 050f2478d3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 4 deletions

View File

@ -1242,7 +1242,9 @@ class DeviceRoleCSVForm(forms.ModelForm):
#
class PlatformForm(BootstrapMixin, forms.ModelForm):
slug = SlugField()
slug = SlugField(
max_length=64
)
class Meta:
model = Platform

View File

@ -0,0 +1,23 @@
# Generated by Django 2.2 on 2019-07-17 20:40
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('dcim', '0073_interface_form_factor_to_type'),
]
operations = [
migrations.AlterField(
model_name='platform',
name='name',
field=models.CharField(max_length=64, unique=True),
),
migrations.AlterField(
model_name='platform',
name='slug',
field=models.SlugField(max_length=64, unique=True),
),
]

View File

@ -1385,11 +1385,12 @@ class Platform(ChangeLoggedModel):
specifying a NAPALM driver.
"""
name = models.CharField(
max_length=50,
max_length=64,
unique=True
)
slug = models.SlugField(
unique=True
unique=True,
max_length=64
)
manufacturer = models.ForeignKey(
to='dcim.Manufacturer',

View File

@ -47,9 +47,10 @@ $(document).ready(function() {
});
if (slug_field) {
var slug_source = $('#id_' + slug_field.attr('slug-source'));
var slug_length = slug_field.attr('maxlength');
slug_source.on('keyup change', function() {
if (slug_field && !slug_field.attr('_changed')) {
slug_field.val(slugify($(this).val(), 50));
slug_field.val(slugify($(this).val(), (slug_length ? slug_length : 50)));
}
})
}