MCPcopy Create free account
hub / github.com/alphagov/notifications-api / TemplateEmailFile

Class TemplateEmailFile

app/models.py:1351–1367  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1349 return db.relationship("User", foreign_keys=[cls.archived_by_id])
1350
1351
1352class TemplateEmailFile(TemplateEmailFileBase):
1353 __tablename__ = "template_email_files"
1354
1355 version = db.Column(db.Integer, default=0, nullable=False)
1356 template = db.relationship("Template", backref="email_files")
1357
1358 @classmethod
1359 def from_json(cls, data):
1360 """
1361 Assumption: data has been validated appropriately.
1362
1363 Returns a TemplateEmailFile object based on the provided data. Deserialises created_by to created_by_id as
1364 marshmallow would.
1365 """
1366 fields = data.copy()
1367 fields["created_at"] = datetime.datetime.utcnow()
1368 return cls(**fields)
1369
1370

Calls

no outgoing calls

Tested by 1