forms.py 3.7 KB

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