import marshmallow


class StorySchema(marshmallow.Schema):
    id = marshmallow.fields.Int(dump_only=True)
    title = marshmallow.fields.Str(required=True)
    created = marshmallow.fields.DateTime(dump_only=True)
    event_time = marshmallow.fields.DateTime(allow_none=True)
    location = marshmallow.fields.Str()
    section = marshmallow.fields.Str()

    @marshmallow.post_dump(pass_many=True)
    def wrap(self, data, many):
        key = 'stories' if many else 'story'
        return {key: data}


class PersonSchema(marshmallow.Schema):
    id = marshmallow.fields.Int(dump_only=True)
    name = marshmallow.fields.Str(required=True)

    @marshmallow.post_dump(pass_many=True)
    def wrap(self, data, many):
        key = 'people' if many else 'person'
        return {key: data}


class AddStoryPersonSchema(marshmallow.Schema):
    id = marshmallow.fields.Int()

    @marshmallow.post_dump(pass_many=True)
    def wrap(self, data, many):
        key = 'story_people' if many else 'story_person'
        return {key: data}

@@ -309,16 +309,31 @@
 lds.Str(
+allow_none=True
 )%0A    se
@@ -363,16 +363,31 @@
 lds.Str(
+allow_none=True
 )%0A%0A    @

Allow story location and section to be null