-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use ModelChoice for server select and reformat
- Loading branch information
Showing
1 changed file
with
25 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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") |