53 lines
1.3 KiB
Python
53 lines
1.3 KiB
Python
from django.forms import ModelForm, Textarea, HiddenInput, TextInput
|
|
from minecraft_manager.models import UserSettings, Application, Alert, Ticket, TicketNote, Note
|
|
|
|
|
|
def __all__():
|
|
return [UserSettingsForm, ApplicationForm, AlertForm, TicketForm, TicketNoteForm, NoteForm]
|
|
|
|
|
|
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,
|
|
'message': Textarea,
|
|
}
|
|
|
|
|
|
class NoteForm(ModelForm):
|
|
class Meta:
|
|
model = Note
|
|
fields = ['player', 'message', 'importance']
|
|
widgets = {
|
|
'message': Textarea
|
|
}
|
|
|
|
|
|
class TicketNoteForm(ModelForm):
|
|
class Meta:
|
|
model = TicketNote
|
|
fields = ['ticket', 'message']
|
|
widgets = {
|
|
'ticket': HiddenInput
|
|
}
|