os_init.py 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. from models import FilterFieldType
  4. from models import ORM
  5. __author__ = 'James Iter'
  6. __date__ = '2017/3/23'
  7. __contact__ = 'james.iter.cn@gmail.com'
  8. __copyright__ = '(c) 2017 by James Iter.'
  9. class OSInit(ORM):
  10. _table_name = 'os_init'
  11. _primary_key = 'id'
  12. def __init__(self):
  13. super(OSInit, self).__init__()
  14. self.id = 0
  15. self.name = None
  16. self.remark = ''
  17. @staticmethod
  18. def get_filter_keywords():
  19. return {
  20. 'id': FilterFieldType.INT.value,
  21. 'name': FilterFieldType.STR.value,
  22. 'remark': FilterFieldType.STR.value
  23. }
  24. @staticmethod
  25. def get_allow_update_keywords():
  26. return ['remark']
  27. @staticmethod
  28. def get_allow_content_search_keywords():
  29. return ['name', 'remark']
  30. class OSInitWrite(ORM):
  31. _table_name = 'os_init_write'
  32. _primary_key = 'id'
  33. def __init__(self):
  34. super(OSInitWrite, self).__init__()
  35. self.id = 0
  36. self.os_init_id = None
  37. self.path = ''
  38. self.content = ''
  39. @staticmethod
  40. def get_filter_keywords():
  41. return {
  42. 'id': FilterFieldType.INT.value,
  43. 'os_init_id': FilterFieldType.STR.value,
  44. 'path': FilterFieldType.STR.value
  45. }
  46. @staticmethod
  47. def get_allow_update_keywords():
  48. return ['os_init_id', 'path']
  49. @staticmethod
  50. def get_allow_content_search_keywords():
  51. return ['path', 'content']