use config to get default sender rather than hardcoding

this means that on non-prod envs, it reflects that environment.

it needs to be a lamdba, because the column object is created at import
time, when current_app.config won't have been loaded - this means that
when you create a Service object, that lambda executes and grabs the
correct default value
This commit is contained in:
Leo Hemsted
2017-05-23 10:35:13 +01:00
parent 2535a7fe98
commit 86c9600b04
4 changed files with 9 additions and 9 deletions

View File

@@ -199,7 +199,7 @@ class Service(db.Model, Versioned):
created_by_id = db.Column(UUID(as_uuid=True), db.ForeignKey('users.id'), index=True, nullable=False)
reply_to_email_address = db.Column(db.Text, index=False, unique=False, nullable=True)
letter_contact_block = db.Column(db.Text, index=False, unique=False, nullable=True)
sms_sender = db.Column(db.String(11), nullable=True, default='GOVUK')
sms_sender = db.Column(db.String(11), nullable=True, default=lambda: current_app.config['FROM_NUMBER'])
organisation_id = db.Column(UUID(as_uuid=True), db.ForeignKey('organisation.id'), index=True, nullable=True)
organisation = db.relationship('Organisation')
dvla_organisation_id = db.Column(