Skip to content

Commit

Permalink
Use ModelChoice for server select and reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
zediious committed Nov 9, 2023
1 parent ede8d08 commit de321cd
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions raptorWeb/gameservers/forms.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,34 @@
from django import forms

from raptorWeb.gameservers.models import Server

class StatisticFilterForm(forms.Form):
start = forms.DateTimeField(required=False, widget=forms.DateTimeInput(attrs={'type': 'datetime-local'}))
end = forms.DateTimeField(required=False, widget=forms.DateTimeInput(attrs={'type': 'datetime-local'}))
server = forms.CharField()
start = forms.DateTimeField(
required=False,
widget=forms.DateTimeInput(attrs={'type': 'datetime-local'}))

end = forms.DateTimeField(
required=False,
widget=forms.DateTimeInput(attrs={'type': 'datetime-local'}))

server = forms.ModelChoiceField(
queryset=Server.objects.filter(archived=False),
empty_label="Choose a Server")

class StatisticFilterFormFireFox(forms.Form):
"""
Firefox does not support the datetime-local HTML5 widget
and as such needs to be supplied with only a date widget.
"""
start = forms.DateTimeField(required=False, widget=forms.DateTimeInput(attrs={'type': 'date'}))
end = forms.DateTimeField(required=False, widget=forms.DateTimeInput(attrs={'type': 'date'}))
server = forms.CharField()
start = forms.DateTimeField(
required=False,
widget=forms.DateTimeInput(attrs={'type': 'date'}))

end = forms.DateTimeField(
required=False,
widget=forms.DateTimeInput(attrs={'type': 'date'}))

server = forms.ModelChoiceField(
queryset=Server.objects.filter(archived=False),
to_field_name='modpack_name',
empty_label="Choose a Server")

0 comments on commit de321cd

Please sign in to comment.