#!/usr/bin/env python # -*- coding: utf-8 -*- """ demeter web page name:content.py 内容相关页面 author:rabin """ from __load__ import * class article_path(Load): @tornado.web.authenticated def get(self): self.common( name = u'文章' ,path = '/content/article' ,width = '800' ,height = '400' ,search = (('label-1','cdate-time-start','cdate-time-end','category_id-select-','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'文章分类',u'文章标题')) ,thead = (u'文章标题', u'文章分类', u'更新时间') ,tbody = ('name', 'category', 'cdate') ,state = True ) self.data['common']['search_category_id-select-'] = self.service('common').list('article_category') self.commonList('article') if self.data['list']: for key, value in enumerate(self.data['list']): category = self.service('common').one('article_category', id=value['category_id']) self.data['list'][key]['category'] = category['name'] self.commonView('list') class article_update_path(Load): @tornado.web.authenticated def get(self): self.common( path = '/content/article' ,label = (u'文章标题',u'文章分类',u'文章内容') ,update = ('name-input-required','category_id-select-required',u'content-editor--请输入内容') ,update_category_id = self.service('common').list('article_category') ) self.commonOne('article') self.commonView('update') @tornado.web.authenticated def post(self): self.commonUpdate('article') @tornado.web.authenticated def delete(self): self.commonDelete('article') class category_path(Load): @tornado.web.authenticated def get(self): self.common( name = u'分类' ,path = '/content/category' ,width = '600' ,height = '200' ,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'分类名称')) ,thead = (u'分类名称', u'更新时间') ,tbody = ('name', 'cdate') ,state = True ) self.commonList('article_category') self.commonView('list') class category_update_path(Load): @tornado.web.authenticated def get(self): self.common( path = '/content/category' ,label = (u'分类名称',) ,update = ('name-input-required',) ) self.commonOne('article_category') self.commonView('update') @tornado.web.authenticated def post(self): self.commonUpdate('article_category') @tornado.web.authenticated def delete(self): self.commonDelete('article_category') class info_path(Load): @tornado.web.authenticated def get(self): self.common( path = '/content/info' ,label = (u'首页大标题',u'首页小标题',u'网站头部图片',u'产品功能',u'微信管理',u'客户案例') ,update = ('name-input-required','subname-input-required','pic-pic-required',u'product-editor-required-请输入内容',u'weixin-editor-required-请输入内容',u'demo-editor-required-请输入内容') ) self.commonOne('content', id=1) self.commonView('set') @tornado.web.authenticated def post(self): self.commonUpdate('content',id=1)