mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
AddFile: Activate scenarios.
This commit is contained in:
1 parent
8b9bb68ac5
commit
1cfc7e6638
4 files changed
+67
-20
No files matched your search
@@ -157,6 +157,25 @@ class SQLModel(SQL):
|
||||
class SQLSubModel(PamhyrID):
|
||||
_sub_classes = []
|
||||
|
||||
def __init__(self, id: int = -1, status=None,
|
||||
owner_scenario=-1):
|
||||
super(SQLSubModel, self).__init__(id)
|
||||
|
||||
self._status = status
|
||||
self._owner_scenario = 0
|
||||
if owner_scenario == -1:
|
||||
if status is not None:
|
||||
self._owner_scenario = self._status.scenario_id
|
||||
else:
|
||||
self._owner_scenario = owner_scenario
|
||||
|
||||
def must_be_saved(self):
|
||||
return self._owner_scenario == self._status.scenario_id
|
||||
|
||||
def modified(self):
|
||||
self._owner_scenario = self._status.scenario_id
|
||||
self._status.modified()
|
||||
|
||||
def _db_format(self, value):
|
||||
# Replace ''' by ''' to preserve SQL injection
|
||||
if type(value) is str:
|
||||
|
||||
Reference in new issue
Block a user