Files
notifications-api/app/schemas.py
Alexey Bezhan f8e1fbe3e6 Add reply_to fields to template schemas
We're hiding the `service_letter_contact_id` column since it should
only be readable and writable using the `.reply_to` wrapper.

Schemas are defined using `fields.Method` since the fields are
represented by a property on the Template model that requires
template type to be set. When creating a template, if `reply_to`
is defined using `fields.String` it gets assigned at the same time
as `template_type` (or the order of assignments is not defined),
so the schema loader attempts to set `.reply_to` on a Template
object with a `None` `template_type`, which raises an exception.

Using `fields.Method` seems to delay `.reply_to` assignment until
the Template object is created, which means it already has a
valid type.
2017-11-22 14:26:04 +00:00

22 KiB