Rename JSONModel to SerialisedModel 1/2

This class doesn’t actually wrap JSON, it wraps serialised data.

So this name feels better.

This commit only renames the file for an easier diff.
This commit is contained in:
Chris Hill-Scott
2020-06-17 13:33:56 +01:00
parent 415083cc3e
commit 2d96bf0418
2 changed files with 1 additions and 1 deletions

30
app/serialised_models.py Normal file
View File

@@ -0,0 +1,30 @@
from abc import ABC, abstractmethod
class JSONModel(ABC):
@property
@abstractmethod
def ALLOWED_PROPERTIES(self):
pass
def __init__(self, _dict):
for property in self.ALLOWED_PROPERTIES:
setattr(self, property, _dict[property])
def __dir__(self):
return super().__dir__() + list(sorted(self.ALLOWED_PROPERTIES))
class TemplateJSONModel(JSONModel):
ALLOWED_PROPERTIES = {
'archived',
'content',
'id',
'postage',
'process_type',
'reply_to_text',
'subject',
'template_type',
'version',
}