Repository: netbox-community/netbox

Issue:
Increase max length of platform name field
<!--
    NOTE: This form is only for proposing specific new features or enhancements.
    If you have a general idea or question, please post to our mailing list
    instead of opening an issue:

        https://groups.google.com/forum/#!forum/netbox-discuss

    NOTE: Due to an excessive backlog of feature requests, we are not currently
    accepting any proposals which significantly extend NetBox's feature scope.

    Please describe the environment in which you are running NetBox. Be sure
    that you are running an unmodified instance of the latest stable release
    before submitting a bug report.
-->
### Environment
* Python version:  <!-- Example: 3.5.4 --> 3.6.8
* NetBox version:  <!-- Example: 2.3.6 --> 2.6.0

<!--
    Describe in detail the new functionality you are proposing. Include any
    specific changes to work flows, data models, or the user interface.
-->
### Proposed Functionality
Increase the platform name field to more than 65 characters. Optionally, increase the platform slug field accordingly.

<!--
    Convey an example use case for your proposed feature. Write from the
    perspective of a NetBox user who would benefit from the proposed
    functionality and describe how.
--->
### Use Case
We would like to set the platform name of our Windows machines like we did with our Linux ones. Currently, we are using Ansible to gather facts about our hosts and then format a platform name by concatenating `ansible_distribution`, `ansible_distribution_version` and `ansible_architecture` variables.

Examples:
- CentOS 7.5.1804 (x86_64)
- Ubuntu 18.04 (x86_64)
- Microsoft Windows Server 2012 R2 Standard 6.3.9600.0 (64-bit)
- Microsoft Windows Server 2016 Standard 10.0.14393.0 (64-bit)

<!--
    Note any changes to the database schema necessary to support the new
    feature. For example, does the proposal require adding a new model or
    field? (Not all new features require database changes.)
--->
### Database Changes
Increase max_length of platform name field and platform slug field to more than 65 chars.

<!--
    List any new dependencies on external libraries or services that this new
    feature would introduce. For example, does the proposal require the
    installation of a new Python package? (Not all new features introduce new
    dependencies.)
-->
### External Dependencies
No dependency.


Discussion:
Is there any reason why 65 characters was chosen?  The longest microsoft one is only 61 characters.  We currently have a length of 64 characters for a few model name fields in dcim already.
No I gave it as an example. Any higher value than 62 characters (the longest one is Windows Server 2012 R2) will be enough.

Resolving patch:
diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py
--- a/netbox/dcim/forms.py
+++ b/netbox/dcim/forms.py
@@ -1242,7 +1242,9 @@ class Meta:
 #
 
 class PlatformForm(BootstrapMixin, forms.ModelForm):
-    slug = SlugField()
+    slug = SlugField(
+        max_length=64
+    )
 
     class Meta:
         model = Platform
diff --git a/netbox/dcim/migrations/0074_increase_field_length_platform_name_slug.py b/netbox/dcim/migrations/0074_increase_field_length_platform_name_slug.py
new file mode 100644
--- /dev/null
+++ b/netbox/dcim/migrations/0074_increase_field_length_platform_name_slug.py
@@ -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),
+        ),
+    ]
diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py
--- a/netbox/dcim/models.py
+++ b/netbox/dcim/models.py
@@ -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',


Test patch: