forms.py 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. from django import forms
  2. from .models import ChannelSettings
  3. class ChannelSettingsForm(forms.ModelForm):
  4. class Meta:
  5. model = ChannelSettings
  6. fields = ['interact']
  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. }
  33. # class HostForm(ModelForm):
  34. # class Meta:
  35. # model=Host
  36. # exclude=['network', 'connection_attempts', 'connection_succeeds']
  37. # labels={
  38. # 'address': '<i class="server icon"></i>Address',
  39. # 'port': '<i class="dungeon icon"></i>Port',
  40. # 'ssl': '<i class="lock icon"></i>Use SSL',
  41. # }
  42. # widgets={
  43. # 'ssl': forms.CheckboxInput(attrs={'_style': 'inverted toggle',}),
  44. # }
  45. # layout = [
  46. # ('Four Fields',
  47. # ('Field', 'address'),
  48. # ('Field', 'port'),
  49. # ('Field', 'ssl'),
  50. # ('Field', 'DELETE'),
  51. # )
  52. # ]
  53. # class OwnerForm(ModelForm):
  54. # class Meta:
  55. # model=Owner
  56. # exclude=['network',]
  57. # labels={
  58. # 'hostmask': '<i class="fingerprint icon"></i>Owner hostmask',
  59. # }
  60. # layout = [
  61. # ('Two Fields',
  62. # ('Field', 'hostmask'),
  63. # ('Field', 'DELETE'),
  64. # )
  65. # ]
  66. # class ChannelForm(ModelForm):
  67. # class Meta:
  68. # model=Channel
  69. # fields=['autojoin', 'statistic_commands', 'games', 'chat']
  70. # labels={
  71. # 'autojoin': '<i class="power icon"></i>Auto join',
  72. # 'statistic_commands': '<i class="chart pie icon"></i>Statistic commands',
  73. # 'chat': '<i class="comment dots icon"></i>Chat',
  74. # 'games': '<i class="gamepad icon"></i>Games',
  75. # }
  76. # widgets={
  77. # 'autojoin': forms.CheckboxInput(attrs={'_style': 'inverted toggle'}),
  78. # 'statistic_commands': forms.CheckboxInput(attrs={'_style': 'inverted toggle'}),
  79. # 'chat': forms.CheckboxInput(attrs={'_style': 'inverted toggle'}),
  80. # 'games': forms.CheckboxInput(attrs={'_style': 'inverted toggle'}),
  81. # }
  82. # class CurseWordForm(ModelForm):
  83. # class Meta:
  84. # model=CurseWord
  85. # fields={'content'}
  86. # labels={
  87. # 'content': '<i class="book dead icon"></i>Curse word'
  88. # }
  89. # widgets={
  90. # 'content': forms.TextInput(attrs={'_no_required': 'True'}),
  91. # }
  92. # class AdjectiveForm(ModelForm):
  93. # class Meta:
  94. # model=Adjective
  95. # fields={'content'}
  96. # labels={
  97. # 'content': '<i class="book dead icon"></i>Adjective'
  98. # }
  99. # widgets={
  100. # 'content': forms.TextInput(attrs={'_no_required': 'True'}),
  101. # }