Coverage for app/models/eventTemplate.py: 100%
16 statements
« prev ^ index » next coverage.py v7.2.7, created at 2024-11-23 03:00 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2024-11-23 03:00 +0000
1import json
3from app.models import *
5class EventTemplate(baseModel):
6 name = CharField()
7 tag = CharField()
8 templateJSON = CharField()
9 templateFile = CharField()
10 isVisible = BooleanField(default=True)
12 def fetch(self, key, default=None):
13 """
14 Get a key from the template data. Return the provided default value if the key is not found.
15 """
16 return self.templateData.get(key, default)
18 @property
19 def templateData(self):
20 return json.loads(self.templateJSON)
22 @templateData.setter
23 def templateData(self, value):
24 self.templateJSON = json.dumps(value)