forums.py 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # **************************************************************************
  4. # Copyright © 2016 jianglin
  5. # File Name: forums.py
  6. # Author: jianglin
  7. # Email: xiyang0807@gmail.com
  8. # Created: 2016-12-17 13:12:23 (CST)
  9. # Last Update:星期三 2017-3-29 21:5:42 (CST)
  10. # By:
  11. # Description:
  12. # **************************************************************************
  13. from .views import BaseView
  14. from forums.extension import db
  15. from forums.api.forums.models import Board
  16. from forums.api.tag.models import Tags
  17. class BoardView(BaseView):
  18. form_excluded_columns = ('topics')
  19. class TagView(BaseView):
  20. column_searchable_list = ['name']
  21. form_excluded_columns = ('topics', 'followers')
  22. def register_forums(admin):
  23. admin.add_view(
  24. BoardView(
  25. Board,
  26. db.session,
  27. name='管理版块',
  28. endpoint='admin_board',
  29. category='管理社区'))
  30. admin.add_view(
  31. TagView(
  32. Tags,
  33. db.session,
  34. name='管理节点',
  35. endpoint='admin_tag',
  36. category='管理社区'))