Coverage for backend/core/auxiliary/models/Expression.py: 100%

13 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-11-06 23:27 +0000

1from django.db import models 

2from core.auxiliary.models.Scenario import Scenario 

3from core.managers import AccessControlManager 

4from core.auxiliary.models.Flowsheet import Flowsheet 

5 

6class Expression(models.Model): 

7 """ 

8 This basically represents a column in the csv file that a user has uploaded. 

9 It was originally intended to store mathematical expressions, but we have formulas on the 

10 PropertyValue now, so that functionality is not needed here. 

11 Now it just stores the name of the CSV column (or potential Live Data Source) 

12 """ 

13 # TODO: Rename to CSVColumn or sometihng similar. See also SolveState.py 

14 

15 flowsheet = models.ForeignKey(Flowsheet, on_delete=models.CASCADE, related_name="expressions") 

16 name = models.TextField(blank=True) 

17 value = models.TextField(blank=True,max_length=2048) # TODO: Pretty sure this is not used and can be removed. 

18 scenario = models.ForeignKey(Scenario, on_delete=models.CASCADE, related_name="expressions") 

19 

20 created_at = models.DateTimeField(auto_now_add=True) 

21 

22 objects = AccessControlManager() 

23 

24 

25 

26 class Meta: 

27 ordering = ['created_at']