mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-24 17:38:37 -06:00
This commit is contained in:
parent
9c6dbd7337
commit
050f2478d3
@ -1242,7 +1242,9 @@ class DeviceRoleCSVForm(forms.ModelForm):
|
|||||||
#
|
#
|
||||||
|
|
||||||
class PlatformForm(BootstrapMixin, forms.ModelForm):
|
class PlatformForm(BootstrapMixin, forms.ModelForm):
|
||||||
slug = SlugField()
|
slug = SlugField(
|
||||||
|
max_length=64
|
||||||
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Platform
|
model = Platform
|
||||||
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
@ -1385,11 +1385,12 @@ class Platform(ChangeLoggedModel):
|
|||||||
specifying a NAPALM driver.
|
specifying a NAPALM driver.
|
||||||
"""
|
"""
|
||||||
name = models.CharField(
|
name = models.CharField(
|
||||||
max_length=50,
|
max_length=64,
|
||||||
unique=True
|
unique=True
|
||||||
)
|
)
|
||||||
slug = models.SlugField(
|
slug = models.SlugField(
|
||||||
unique=True
|
unique=True,
|
||||||
|
max_length=64
|
||||||
)
|
)
|
||||||
manufacturer = models.ForeignKey(
|
manufacturer = models.ForeignKey(
|
||||||
to='dcim.Manufacturer',
|
to='dcim.Manufacturer',
|
||||||
|
@ -47,9 +47,10 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
if (slug_field) {
|
if (slug_field) {
|
||||||
var slug_source = $('#id_' + slug_field.attr('slug-source'));
|
var slug_source = $('#id_' + slug_field.attr('slug-source'));
|
||||||
|
var slug_length = slug_field.attr('maxlength');
|
||||||
slug_source.on('keyup change', function() {
|
slug_source.on('keyup change', function() {
|
||||||
if (slug_field && !slug_field.attr('_changed')) {
|
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)));
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user