Chapter - applebiter/gnatwriter GitHub Wiki

The Chapter class represents a chapter of a Story.

Attributes

The attributes that are mapped to the chapters table in the database:

  • id: int The Chapter ID
  • user_id: int The ID of the User who created the database entry
  • story_id: int The Story ID
  • position: int The position of this Chapter among all Chapters in the Story (1-based)
  • title: str The Chapter title
  • description: str The Chapter description, optional
  • created: str The creation datetime of the database entry, stored in 'yyyy-mm-dd hh:mm:ss.f' format
  • modified: str The last datetime the Chapter was modified in the database, stored in 'yyyy-mm-dd hh:mm:ss.f' format

The following, complex attributes are returned by the ORM:

  • user: User The user who created this database entry. The User is associated with the users table in the database.
  • story: Story The Story to which this Chapter belongs.
  • links: List[ChapterLink] A list of Links, if any, associated with the Chapter. This attribute is eager-loaded.
  • notes: List[ChapterNote] A list of Notes, if any, associated with the Chapter. This attribute is eager-loaded.

serialize()

serialize ( ) -> dict In addition to the attributes mapped to the chapters table, all data belonging to Scenes, Links, and Notes associated with the Chapter will also be present in the serialized output.