1
0

forms.py 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  1. from django import forms
  2. from stats.models import Channel
  3. class ChannelSettingsForm(forms.ModelForm):
  4. class Meta:
  5. model = Channel
  6. fields = ['interact', 'games']
  7. #fields = '__all__'
  8. #exclude = ['id'] #Does not need "fields = '__all__'".
  9. labels = {
  10. 'interact': 'Interact',
  11. # 'slug': '<i class="linkify icon"></i>Slug',
  12. # 'nickname': '<i class="id badge icon"></i>Nickname',
  13. # 'username': '<i class="id card icon"></i>Username',
  14. # 'password': '<i class="privacy icon"></i>Password',
  15. # 'mail': '<i class="envelope icon"></i>NickServ registration E-mail',
  16. # 'home_channel': '<i class="hashtag icon"></i>Home channel',
  17. # 'command_character': '<i class="terminal icon"></i>Command character',
  18. # 'help_character': '<i class="help icon"></i>Help character',
  19. # 'services': '<i class="lightbulb outline icon"></i>Network services',
  20. # 'enabled': '<i class="power off icon"></i>Enabled',
  21. # # 'mute': '<i class="comment slash icon"></i>Mute',
  22. }
  23. widgets={
  24. 'interact': forms.CheckboxInput(attrs={
  25. '_style': 'inverted toggle',
  26. '_icon': 'comment dots',
  27. '_align': 'left',
  28. #'_no_label': True,
  29. '_help': True,
  30. #'_inline': False,
  31. }),
  32. 'games': forms.CheckboxInput(attrs={
  33. '_style': 'inverted toggle',
  34. '_icon': 'gamepad icon',
  35. '_align': 'left',
  36. # '_no_label': True,
  37. '_help': True,
  38. # '_inline': False,
  39. }),
  40. }
  41. # class HostForm(ModelForm):
  42. # class Meta:
  43. # model=Host
  44. # exclude=['network', 'connection_attempts', 'connection_succeeds']
  45. # labels={
  46. # 'address': '<i class="server icon"></i>Address',
  47. # 'port': '<i class="dungeon icon"></i>Port',
  48. # 'ssl': '<i class="lock icon"></i>Use SSL',
  49. # }
  50. # widgets={
  51. # 'ssl': forms.CheckboxInput(attrs={'_style': 'inverted toggle',}),
  52. # }
  53. # layout = [
  54. # ('Four Fields',
  55. # ('Field', 'address'),
  56. # ('Field', 'port'),
  57. # ('Field', 'ssl'),
  58. # ('Field', 'DELETE'),
  59. # )
  60. # ]
  61. # class OwnerForm(ModelForm):
  62. # class Meta:
  63. # model=Owner
  64. # exclude=['network',]
  65. # labels={
  66. # 'hostmask': '<i class="fingerprint icon"></i>Owner hostmask',
  67. # }
  68. # layout = [
  69. # ('Two Fields',
  70. # ('Field', 'hostmask'),
  71. # ('Field', 'DELETE'),
  72. # )
  73. # ]
  74. # class ChannelForm(ModelForm):
  75. # class Meta:
  76. # model=Channel
  77. # fields=['autojoin', 'statistic_commands', 'games', 'chat']
  78. # labels={
  79. # 'autojoin': '<i class="power icon"></i>Auto join',
  80. # 'statistic_commands': '<i class="chart pie icon"></i>Statistic commands',
  81. # 'chat': '<i class="comment dots icon"></i>Chat',
  82. # 'games': '<i class="gamepad icon"></i>Games',
  83. # }
  84. # widgets={
  85. # 'autojoin': forms.CheckboxInput(attrs={'_style': 'inverted toggle'}),
  86. # 'statistic_commands': forms.CheckboxInput(attrs={'_style': 'inverted toggle'}),
  87. # 'chat': forms.CheckboxInput(attrs={'_style': 'inverted toggle'}),
  88. # 'games': forms.CheckboxInput(attrs={'_style': 'inverted toggle'}),
  89. # }
  90. # class CurseWordForm(ModelForm):
  91. # class Meta:
  92. # model=CurseWord
  93. # fields={'content'}
  94. # labels={
  95. # 'content': '<i class="book dead icon"></i>Curse word'
  96. # }
  97. # widgets={
  98. # 'content': forms.TextInput(attrs={'_no_required': 'True'}),
  99. # }
  100. # class AdjectiveForm(ModelForm):
  101. # class Meta:
  102. # model=Adjective
  103. # fields={'content'}
  104. # labels={
  105. # 'content': '<i class="book dead icon"></i>Adjective'
  106. # }
  107. # widgets={
  108. # 'content': forms.TextInput(attrs={'_no_required': 'True'}),
  109. # }