- 新增 game.story.volume / game.story.chapter 模型 + 后台菜单视图 - 新增 /game/api/story(目录) 与 /game/api/story/chapter/<id>(正文) 接口 - 三块补充 Odoo 默认种子数据(剧情 2 卷 5 章、论坛 5 帖、公告 4 条) - 前端:剧情改造为左目录 + 右正文的小说阅读器;论坛改为登录后可见(auth-only);论坛/公告调整为竖排阅读布局
28 lines
983 B
Python
28 lines
983 B
Python
# -*- coding: utf-8 -*-
|
|
from odoo import models, fields
|
|
|
|
|
|
class GameStoryVolume(models.Model):
|
|
_name = 'game.story.volume'
|
|
_description = '小说卷'
|
|
_order = 'sequence, id'
|
|
_rec_name = 'name'
|
|
|
|
name = fields.Char(string='卷名', required=True, index=True)
|
|
sequence = fields.Integer(string='序号', default=10, index=True)
|
|
intro = fields.Html(string='卷首语')
|
|
chapter_ids = fields.One2many('game.story.chapter', 'volume_id', string='章节')
|
|
|
|
|
|
class GameStoryChapter(models.Model):
|
|
_name = 'game.story.chapter'
|
|
_description = '小说章节'
|
|
_order = 'volume_id, sequence, id'
|
|
_rec_name = 'name'
|
|
|
|
volume_id = fields.Many2one('game.story.volume', string='所属卷',
|
|
required=True, ondelete='cascade', index=True)
|
|
name = fields.Char(string='章名', required=True, index=True)
|
|
sequence = fields.Integer(string='序号', default=10, index=True)
|
|
body_html = fields.Html(string='正文')
|