from django import forms from stats.models import Channel class ChannelSettingsForm(forms.ModelForm): class Meta: model = Channel fields = ['interact', 'games'] #fields = '__all__' #exclude = ['id'] #Does not need "fields = '__all__'". labels = { 'interact': 'Interact', # 'slug': 'Slug', # 'nickname': 'Nickname', # 'username': 'Username', # 'password': 'Password', # 'mail': 'NickServ registration E-mail', # 'home_channel': 'Home channel', # 'command_character': 'Command character', # 'help_character': 'Help character', # 'services': 'Network services', # 'enabled': 'Enabled', # # 'mute': 'Mute', } widgets={ 'interact': forms.CheckboxInput(attrs={ '_style': 'inverted toggle', '_icon': 'comment dots', '_align': 'left', #'_no_label': True, '_help': True, #'_inline': False, }), 'games': forms.CheckboxInput(attrs={ '_style': 'inverted toggle', '_icon': 'gamepad icon', '_align': 'left', # '_no_label': True, '_help': True, # '_inline': False, }), } # class HostForm(ModelForm): # class Meta: # model=Host # exclude=['network', 'connection_attempts', 'connection_succeeds'] # labels={ # 'address': 'Address', # 'port': 'Port', # 'ssl': 'Use SSL', # } # widgets={ # 'ssl': forms.CheckboxInput(attrs={'_style': 'inverted toggle',}), # } # layout = [ # ('Four Fields', # ('Field', 'address'), # ('Field', 'port'), # ('Field', 'ssl'), # ('Field', 'DELETE'), # ) # ] # class OwnerForm(ModelForm): # class Meta: # model=Owner # exclude=['network',] # labels={ # 'hostmask': 'Owner hostmask', # } # layout = [ # ('Two Fields', # ('Field', 'hostmask'), # ('Field', 'DELETE'), # ) # ] # class ChannelForm(ModelForm): # class Meta: # model=Channel # fields=['autojoin', 'statistic_commands', 'games', 'chat'] # labels={ # 'autojoin': 'Auto join', # 'statistic_commands': 'Statistic commands', # 'chat': 'Chat', # 'games': 'Games', # } # widgets={ # 'autojoin': forms.CheckboxInput(attrs={'_style': 'inverted toggle'}), # 'statistic_commands': forms.CheckboxInput(attrs={'_style': 'inverted toggle'}), # 'chat': forms.CheckboxInput(attrs={'_style': 'inverted toggle'}), # 'games': forms.CheckboxInput(attrs={'_style': 'inverted toggle'}), # } # class CurseWordForm(ModelForm): # class Meta: # model=CurseWord # fields={'content'} # labels={ # 'content': 'Curse word' # } # widgets={ # 'content': forms.TextInput(attrs={'_no_required': 'True'}), # } # class AdjectiveForm(ModelForm): # class Meta: # model=Adjective # fields={'content'} # labels={ # 'content': 'Adjective' # } # widgets={ # 'content': forms.TextInput(attrs={'_no_required': 'True'}), # }