content.py 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. """
  4. demeter web page
  5. name:content.py 内容相关页面
  6. author:rabin
  7. """
  8. from __load__ import *
  9. class article_path(Load):
  10. @tornado.web.authenticated
  11. def get(self):
  12. self.common(
  13. name = u'文章'
  14. ,path = '/content/article'
  15. ,width = '800'
  16. ,height = '400'
  17. ,search = (('label-1','cdate-time-start','cdate-time-end','category_id-select-','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'文章分类',u'文章标题'))
  18. ,thead = (u'文章标题', u'文章分类', u'更新时间')
  19. ,tbody = ('name', 'category', 'cdate')
  20. ,state = True
  21. )
  22. self.data['common']['search_category_id-select-'] = self.service('common').list('article_category')
  23. self.commonList('article')
  24. if self.data['list']:
  25. for key, value in enumerate(self.data['list']):
  26. category = self.service('common').one('article_category', id=value['category_id'])
  27. self.data['list'][key]['category'] = category['name']
  28. self.commonView('list')
  29. class article_update_path(Load):
  30. @tornado.web.authenticated
  31. def get(self):
  32. self.common(
  33. path = '/content/article'
  34. ,label = (u'文章标题',u'文章分类',u'文章内容')
  35. ,update = ('name-input-required','category_id-select-required',u'content-editor--请输入内容')
  36. ,update_category_id = self.service('common').list('article_category')
  37. )
  38. self.commonOne('article')
  39. self.commonView('update')
  40. @tornado.web.authenticated
  41. def post(self):
  42. self.commonUpdate('article')
  43. @tornado.web.authenticated
  44. def delete(self):
  45. self.commonDelete('article')
  46. class category_path(Load):
  47. @tornado.web.authenticated
  48. def get(self):
  49. self.common(
  50. name = u'分类'
  51. ,path = '/content/category'
  52. ,width = '600'
  53. ,height = '200'
  54. ,search = (('label-1','cdate-time-start','cdate-time-end','name-input-mlike'), (u'日期范围',u'开始时间',u'截止时间',u'分类名称'))
  55. ,thead = (u'分类名称', u'更新时间')
  56. ,tbody = ('name', 'cdate')
  57. ,state = True
  58. )
  59. self.commonList('article_category')
  60. self.commonView('list')
  61. class category_update_path(Load):
  62. @tornado.web.authenticated
  63. def get(self):
  64. self.common(
  65. path = '/content/category'
  66. ,label = (u'分类名称',)
  67. ,update = ('name-input-required',)
  68. )
  69. self.commonOne('article_category')
  70. self.commonView('update')
  71. @tornado.web.authenticated
  72. def post(self):
  73. self.commonUpdate('article_category')
  74. @tornado.web.authenticated
  75. def delete(self):
  76. self.commonDelete('article_category')
  77. class info_path(Load):
  78. @tornado.web.authenticated
  79. def get(self):
  80. self.common(
  81. path = '/content/info'
  82. ,label = (u'首页大标题',u'首页小标题',u'网站头部图片',u'产品功能',u'微信管理',u'客户案例')
  83. ,update = ('name-input-required','subname-input-required','pic-pic-required',u'product-editor-required-请输入内容',u'weixin-editor-required-请输入内容',u'demo-editor-required-请输入内容')
  84. )
  85. self.commonOne('content', id=1)
  86. self.commonView('set')
  87. @tornado.web.authenticated
  88. def post(self):
  89. self.commonUpdate('content',id=1)