2018-09-20 02:56:17 +00:00
|
|
|
from django.forms import ModelForm, Textarea, HiddenInput, TextInput
|
2018-12-13 21:18:29 +00:00
|
|
|
from minecraft_manager.models import UserSettings, Application, Alert, Ticket, TicketNote, Note
|
2018-09-20 02:56:17 +00:00
|
|
|
|
|
|
|
|
|
|
|
def __all__():
|
2018-12-13 21:18:29 +00:00
|
|
|
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,
|
2021-02-08 04:08:36 +00:00
|
|
|
'message': Textarea(attrs={'style': 'display: block;'}),
|
2018-09-20 02:56:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-12-13 21:18:29 +00:00
|
|
|
class NoteForm(ModelForm):
|
2018-09-20 02:56:17 +00:00
|
|
|
class Meta:
|
2018-12-13 21:18:29 +00:00
|
|
|
model = Note
|
|
|
|
fields = ['player', 'message', 'importance']
|
2018-09-20 02:56:17 +00:00
|
|
|
widgets = {
|
2021-02-08 04:08:36 +00:00
|
|
|
'message': Textarea(attrs={'style': 'display: block;'})
|
2018-09-20 02:56:17 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-12-13 21:18:29 +00:00
|
|
|
class TicketNoteForm(ModelForm):
|
2018-09-20 02:56:17 +00:00
|
|
|
class Meta:
|
2018-12-13 21:18:29 +00:00
|
|
|
model = TicketNote
|
|
|
|
fields = ['ticket', 'message']
|
2018-09-20 02:56:17 +00:00
|
|
|
widgets = {
|
2018-12-13 21:18:29 +00:00
|
|
|
'ticket': HiddenInput
|
2018-09-20 02:56:17 +00:00
|
|
|
}
|