Add a load only and dump only for the created_by attribute of the JobSchema

This commit is contained in:
Rebecca Law
2016-05-11 12:03:25 +01:00
parent b8017dcf02
commit aff0abb78c
2 changed files with 5 additions and 0 deletions

View File

@@ -143,6 +143,10 @@ class ApiKeySchema(BaseSchema):
class JobSchema(BaseSchema):
created_by_user = fields.Nested(UserSchema, attribute="created_by",
dump_to="created_by", only=["id", "name"], dump_only=True)
created_by = field_for(models.Job, 'created_by', required=True, load_only=True)
class Meta:
model = models.Job