minecraft_manager/forms.py

53 lines
1.4 KiB
Python
Raw Permalink Normal View History

2018-09-20 02:56:17 +00:00
from django.forms import ModelForm, Textarea, HiddenInput, TextInput
from minecraft_manager.models import UserSettings, Application, Alert, Ticket, TicketNote, Note
2018-09-20 02:56:17 +00:00
def __all__():
return [UserSettingsForm, ApplicationForm, AlertForm, TicketForm, TicketNoteForm, NoteForm]
2018-09-20 02:56:17 +00:00
class UserSettingsForm(ModelForm):
class Meta:
model = UserSettings
fields = ['default_results', 'default_theme', 'default_timezone', 'search_player_ip', 'show_timestamp_chat']
class ApplicationForm(ModelForm):
class Meta:
model = Application
fields = ['username', 'age', 'player_type', 'ever_banned', 'ever_banned_explanation', 'reference', 'read_rules']
class AlertForm(ModelForm):
class Meta:
model = Alert
fields = ['message']
class TicketForm(ModelForm):
class Meta:
model = Ticket
fields = ['player', 'message', 'priority', 'world', 'x', 'y', 'z']
widgets = {
'player': TextInput,
attachments (#2) Add migration for longer timezone Signed-off-by: Etzelia <etzelia@hotmail.com> Merge branch 'master' of birbmc.com:BirbMC/minecraft_manager into birb # Conflicts: # external/views.py Fix col Signed-off-by: Etzelia <etzelia@hotmail.com> Add attachments, clean up UI, etc. Signed-off-by: Etzelia <etzelia@hotmail.com> Fix Discord embeds (#59) Fix Discord embeds Reviewed-on: https://git.etztech.xyz/MMS/MinecraftManagerDjango/pulls/59 Reviewed-by: ZeroHD <joey@ahines.net> Add requirements (not txt) (#57) Add requirements (not txt) Signed-off-by: Etzelia <etzelia@hotmail.com> Reviewed-on: https://git.etztech.xyz/MMS/MinecraftManagerDjango/pulls/57 Reviewed-by: ZeroHD <joey@ahines.net> Interim Patch (#54) Birb Patches (#1) Birb Patches Signed-off-by: Etzelia <etzelia@hotmail.com> Co-authored-by: Etzelia <etzelia@hotmail.com> Reviewed-by: ZeroHD <joey@ahines.net> Add 'LICENSE' (#53) Add 'LICENSE' Reviewed-by: ZeroHD <joey@ahines.net> Fix captcha and generify community invite (#52) Add validation for final question and some minor CSS Signed-off-by: Etzelia <etzelia@hotmail.com> Change some docs Signed-off-by: Etzelia <etzelia@hotmail.com> Fix captcha and generify community invite Signed-off-by: Etzelia <etzelia@hotmail.com> Co-authored-by: Etzelia <etzelia@hotmail.com> Reviewed-by: ZeroHD <joey@ahines.net> Co-authored-by: Etz Elia <etzelia@hotmail.com> Reviewed-on: https://git.birbmc.com/BirbMC/minecraft_manager/pulls/2 Co-Authored-By: Etzelia <etzelia@hotmail.com> Co-Committed-By: Etzelia <etzelia@hotmail.com>
2021-05-06 17:50:18 +00:00
'message': Textarea(attrs={'style': 'display: block;'}),
2018-09-20 02:56:17 +00:00
}
class NoteForm(ModelForm):
2018-09-20 02:56:17 +00:00
class Meta:
model = Note
fields = ['player', 'message', 'importance']
2018-09-20 02:56:17 +00:00
widgets = {
attachments (#2) Add migration for longer timezone Signed-off-by: Etzelia <etzelia@hotmail.com> Merge branch 'master' of birbmc.com:BirbMC/minecraft_manager into birb # Conflicts: # external/views.py Fix col Signed-off-by: Etzelia <etzelia@hotmail.com> Add attachments, clean up UI, etc. Signed-off-by: Etzelia <etzelia@hotmail.com> Fix Discord embeds (#59) Fix Discord embeds Reviewed-on: https://git.etztech.xyz/MMS/MinecraftManagerDjango/pulls/59 Reviewed-by: ZeroHD <joey@ahines.net> Add requirements (not txt) (#57) Add requirements (not txt) Signed-off-by: Etzelia <etzelia@hotmail.com> Reviewed-on: https://git.etztech.xyz/MMS/MinecraftManagerDjango/pulls/57 Reviewed-by: ZeroHD <joey@ahines.net> Interim Patch (#54) Birb Patches (#1) Birb Patches Signed-off-by: Etzelia <etzelia@hotmail.com> Co-authored-by: Etzelia <etzelia@hotmail.com> Reviewed-by: ZeroHD <joey@ahines.net> Add 'LICENSE' (#53) Add 'LICENSE' Reviewed-by: ZeroHD <joey@ahines.net> Fix captcha and generify community invite (#52) Add validation for final question and some minor CSS Signed-off-by: Etzelia <etzelia@hotmail.com> Change some docs Signed-off-by: Etzelia <etzelia@hotmail.com> Fix captcha and generify community invite Signed-off-by: Etzelia <etzelia@hotmail.com> Co-authored-by: Etzelia <etzelia@hotmail.com> Reviewed-by: ZeroHD <joey@ahines.net> Co-authored-by: Etz Elia <etzelia@hotmail.com> Reviewed-on: https://git.birbmc.com/BirbMC/minecraft_manager/pulls/2 Co-Authored-By: Etzelia <etzelia@hotmail.com> Co-Committed-By: Etzelia <etzelia@hotmail.com>
2021-05-06 17:50:18 +00:00
'message': Textarea(attrs={'style': 'display: block;'})
2018-09-20 02:56:17 +00:00
}
class TicketNoteForm(ModelForm):
2018-09-20 02:56:17 +00:00
class Meta:
model = TicketNote
fields = ['ticket', 'message']
2018-09-20 02:56:17 +00:00
widgets = {
'ticket': HiddenInput
2018-09-20 02:56:17 +00:00
}