Coverage for django_napse/core/models/modifications/connection.py: 77%
13 statements
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-12 13:49 +0000
« prev ^ index » next coverage.py v7.4.3, created at 2024-03-12 13:49 +0000
1from django.db import models
3from django_napse.utils.constants import MODIFICATION_STATUS
5from .modification import Modification
8class ConnectionModification(Modification):
9 connection_specific_arg = models.ForeignKey("ConnectionSpecificArgs", on_delete=models.CASCADE, related_name="modifications")
11 def apply(self):
12 connection_specific_arg, self = self._apply()
13 connection_specific_arg.save()
14 self.save()
16 def _apply(self, **kwargs):
17 self.connection_specific_arg.value = self.get_value(current_value=self.connection_specific_arg.get_value(), **kwargs)
18 self.status = MODIFICATION_STATUS.APPLIED
19 return self.connection_specific_arg, self