Coverage for backend/django/flowsheetInternals/propertyPackages/models/SimulationObjectPropertyPackages.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-12-18 04:00 +0000

1from django.db import models 

2from typing import TYPE_CHECKING 

3 

4from core.managers import AccessControlManager 

5 

6if TYPE_CHECKING: 

7 from core.auxiliary.models.Flowsheet import Flowsheet 

8 from flowsheetInternals.unitops.models.SimulationObject import SimulationObject 

9 

10 

11class SimulationObjectPropertyPackages(models.Model): 

12 """ 

13 Model stores the connections between simulation objects and property packages 

14 

15 Simulation objects have a many-to-many relationship with property packages. This relationship 

16 also needs a name to identify the property package in the simulation object. 

17 """ 

18 

19 flowsheet = models.ForeignKey("core_auxiliary.Flowsheet", on_delete=models.CASCADE, related_name="PropertyPackages") 

20 simulationObject = models.ForeignKey("flowsheetInternals_unitops.SimulationObject", on_delete=models.CASCADE, 

21 related_name='propertyPackages', null=True) 

22 propertyPackage = models.CharField(max_length=64, 

23 default="") # currently selected property package name, e.g helmholtz 

24 name = models.CharField(max_length=64, default="") # display name, e.g "hot side" 

25 

26 created_at = models.DateTimeField(auto_now_add=True) 

27 

28 objects = AccessControlManager() 

29 

30 # runtime-accessed attributes 

31 flowsheet: "Flowsheet" 

32 simulationObject: "SimulationObject | None" 

33 

34 class Meta: 

35 ordering = ['created_at']