Example #1
0
 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"]),
     )
 def to_objectchange(self, action):
     """Remove actual and intended configuration from changelog."""
     return ObjectChange(
         changed_object=self,
         object_repr=str(self),
         action=action,
         object_data=serialize_object(self, exclude=["actual", "intended"]),
     )
Example #3
0
 def to_objectchange(self, action):
     return ObjectChange(
         changed_object=self,
         object_repr=str(self),
         action=action,
         # related_object=self.virtual_machine,
         object_data=serialize_object(self),
     )
Example #4
0
 def to_objectchange(self, action):
     # Annotate the assigned object, if any
     return ObjectChange(
         changed_object=self,
         object_repr=str(self),
         action=action,
         related_object=self.assigned_object,
         object_data=serialize_object(self),
     )
Example #5
0
 def to_objectchange(self, action):
     # Annotate the parent VirtualMachine
     return ObjectChange(
         changed_object=self,
         object_repr=str(self),
         action=action,
         related_object=self.virtual_machine,
         object_data=serialize_object(self),
     )
 def to_objectchange(self, action):
     # Annotate the parent DeviceType
     try:
         device_type = self.device_type
     except ObjectDoesNotExist:
         # The parent DeviceType has already been deleted
         device_type = None
     return ObjectChange(
         changed_object=self,
         object_repr=str(self),
         action=action,
         related_object=device_type,
         object_data=serialize_object(self),
     )
Example #7
0
 def to_objectchange(self, action):
     # Annotate the parent field
     try:
         field = self.field
     except ObjectDoesNotExist:
         # The parent field has already been deleted
         field = None
     return ObjectChange(
         changed_object=self,
         object_repr=str(self),
         action=action,
         related_object=field,
         object_data=serialize_object(self),
     )
Example #8
0
    def to_objectchange(self, action):
        # Annotate the parent Circuit
        try:
            related_object = self.circuit
        except Circuit.DoesNotExist:
            # Parent circuit has been deleted
            related_object = None

        return ObjectChange(
            changed_object=self,
            object_repr=str(self),
            action=action,
            related_object=related_object,
            object_data=serialize_object(self),
        )