Arthur il y a 1 mois
Parent
commit
f9b5df87c5

+ 1 - 1
netbox/dcim/models/devices.py

@@ -199,7 +199,7 @@ class DeviceType(ImageAttachmentsMixin, PrimaryModel, WeightMixin):
 
 
     clone_fields = (
     clone_fields = (
         'manufacturer', 'default_platform', 'u_height', 'is_full_depth', 'subdevice_role', 'airflow', 'weight',
         'manufacturer', 'default_platform', 'u_height', 'is_full_depth', 'subdevice_role', 'airflow', 'weight',
-        'weight_unit', 'end_of_life',
+        'weight_unit',
     )
     )
     prerequisite_models = (
     prerequisite_models = (
         'dcim.Manufacturer',
         'dcim.Manufacturer',

+ 1 - 1
netbox/dcim/models/modules.py

@@ -141,7 +141,7 @@ class ModuleType(ImageAttachmentsMixin, PrimaryModel, WeightMixin):
         to_field='module_type'
         to_field='module_type'
     )
     )
 
 
-    clone_fields = ('profile', 'manufacturer', 'weight', 'weight_unit', 'airflow', 'end_of_life')
+    clone_fields = ('profile', 'manufacturer', 'weight', 'weight_unit', 'airflow')
     prerequisite_models = (
     prerequisite_models = (
         'dcim.Manufacturer',
         'dcim.Manufacturer',
     )
     )

+ 4 - 3
netbox/utilities/testing/base.py

@@ -6,7 +6,7 @@ from django.contrib.contenttypes.models import ContentType
 from django.contrib.postgres.fields import ArrayField, RangeField
 from django.contrib.postgres.fields import ArrayField, RangeField
 from django.core.exceptions import FieldDoesNotExist
 from django.core.exceptions import FieldDoesNotExist
 from django.db import transaction
 from django.db import transaction
-from django.db.models import DateField, JSONField, ManyToManyField, ManyToManyRel
+from django.db.models import DateField, DateTimeField, JSONField, ManyToManyField, ManyToManyRel
 from django.forms.models import model_to_dict
 from django.forms.models import model_to_dict
 from django.test import Client
 from django.test import Client
 from django.test import TestCase as _TestCase
 from django.test import TestCase as _TestCase
@@ -214,8 +214,9 @@ class ModelTestCase(TestCase):
                 elif type(value) is IPNetwork:
                 elif type(value) is IPNetwork:
                     model_dict[key] = str(value)
                     model_dict[key] = str(value)
 
 
-                # Convert date values to ISO 8601 strings (as rendered by the REST API)
-                elif type(field) is DateField and value is not None:
+                # Convert date values to ISO 8601 strings (as rendered by the REST API). DateTimeField
+                # subclasses DateField, so exclude it here to preserve existing datetime handling.
+                elif isinstance(field, DateField) and not isinstance(field, DateTimeField) and value is not None:
                     model_dict[key] = value.isoformat()
                     model_dict[key] = value.isoformat()
 
 
                 # Normalize arrays of numeric ranges (e.g. VLAN IDs or port ranges).
                 # Normalize arrays of numeric ranges (e.g. VLAN IDs or port ranges).