forked from Minecraft/minecraft_manager
54 lines
1.4 KiB
Python
54 lines
1.4 KiB
Python
|
from django.forms import ModelForm, Textarea, HiddenInput, TextInput
|
||
|
from minecraft_manager.models import UserSettings, Application, Alert, Ticket, Warning, Note
|
||
|
|
||
|
|
||
|
def __all__():
|
||
|
return [UserSettingsForm, ApplicationForm, AlertForm, TicketForm, WarningForm, 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 WarningForm(ModelForm):
|
||
|
class Meta:
|
||
|
model = Warning
|
||
|
fields = ['player', 'message', 'severity']
|
||
|
widgets = {
|
||
|
'message': Textarea
|
||
|
}
|
||
|
|
||
|
|
||
|
class NoteForm(ModelForm):
|
||
|
class Meta:
|
||
|
model = Note
|
||
|
fields = ['ref_id', 'ref_table', 'message']
|
||
|
widgets = {
|
||
|
'ref_id': HiddenInput,
|
||
|
'ref_table': HiddenInput
|
||
|
}
|