Update service schema to add letter_logo_filename

Added the filename of a service's letter logo to the service schema. We want
this in the schema so that it is possible to call
`current_service.letter_logo_filename` from notifications-admin and to pass this value
through to template-preview.
This commit is contained in:
Katie Smith
2018-10-16 14:50:10 +01:00
parent e0056aad3f
commit e7f0a414ce
2 changed files with 5 additions and 0 deletions

View File

@@ -205,12 +205,16 @@ class ServiceSchema(BaseSchema):
created_by = field_for(models.Service, 'created_by', required=True)
organisation_type = field_for(models.Service, 'organisation_type')
dvla_organisation = field_for(models.Service, 'dvla_organisation')
letter_logo_filename = fields.Method(method_name='get_letter_logo_filename')
permissions = fields.Method("service_permissions")
email_branding = field_for(models.Service, 'email_branding')
organisation = field_for(models.Service, 'organisation')
override_flag = False
letter_contact_block = fields.Method(method_name="get_letter_contact")
def get_letter_logo_filename(self, service):
return service.dvla_organisation.filename
def service_permissions(self, service):
return [p.permission for p in service.permissions]