|
|
@@ -20,10 +20,10 @@ from dcim.choices import *
|
|
|
from dcim.constants import *
|
|
|
from dcim.fields import ASNField
|
|
|
from dcim.elevations import RackElevationSVG
|
|
|
-from extras.models import ConfigContextModel, CustomFieldModel, TaggedItem
|
|
|
+from extras.models import ConfigContextModel, CustomFieldModel, ObjectChange, TaggedItem
|
|
|
from utilities.fields import ColorField, NaturalOrderingField
|
|
|
from utilities.models import ChangeLoggedModel
|
|
|
-from utilities.utils import to_meters
|
|
|
+from utilities.utils import serialize_object, to_meters
|
|
|
from .device_component_templates import (
|
|
|
ConsolePortTemplate, ConsoleServerPortTemplate, DeviceBayTemplate, FrontPortTemplate, InterfaceTemplate,
|
|
|
PowerOutletTemplate, PowerPortTemplate, RearPortTemplate,
|
|
|
@@ -118,6 +118,15 @@ class Region(MPTTModel, ChangeLoggedModel):
|
|
|
Q(region__in=self.get_descendants())
|
|
|
).count()
|
|
|
|
|
|
+ def to_objectchange(self, action):
|
|
|
+ # Remove MPTT-internal fields
|
|
|
+ return ObjectChange(
|
|
|
+ changed_object=self,
|
|
|
+ object_repr=str(self),
|
|
|
+ action=action,
|
|
|
+ object_data=serialize_object(self, exclude=['level', 'lft', 'rght', 'tree_id'])
|
|
|
+ )
|
|
|
+
|
|
|
|
|
|
#
|
|
|
# Sites
|