1 |
9791e4f3
|
Marc Nicolas
|
|
2 |
|
|
from django import forms
|
3 |
|
|
from models import webstatModel
|
4 |
|
|
from datetimewidget.widgets import DateTimeWidget,DateWidget
|
5 |
|
|
|
6 |
|
|
|
7 |
|
|
class webstatForm(forms.ModelForm):
|
8 |
|
|
|
9 |
|
|
class Meta:
|
10 |
|
|
|
11 |
|
|
model = webstatModel
|
12 |
|
|
fields = ['application', 'all_date', 'period_date', 'start_date', 'end_date',
|
13 |
|
|
'is_access_access_by_ip', 'is_access_access_by_months', 'is_access_access_by_country',
|
14 |
|
|
|
15 |
|
|
'is_down_stat_by_user', 'is_down_stat_by_ip', 'is_down_stat_by_country', 'is_down_stat_by_months',
|
16 |
|
|
'is_down_stat_by_project', 'is_just_down_stat']
|
17 |
|
|
|
18 |
|
|
labels = {
|
19 |
|
|
'application': 'Webapp SITools2 ',
|
20 |
|
|
'start_date': 'Du ',
|
21 |
|
|
'end_date': ' Au ',
|
22 |
|
|
'all_date': 'Tous',
|
23 |
|
|
'period_date': 'Sur une période',
|
24 |
|
|
'is_access_access_by_ip': 'Access by Ip',
|
25 |
|
|
'is_access_access_by_months': 'Access by Month',
|
26 |
|
|
'is_access_access_by_country': 'Access by Country',
|
27 |
|
|
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
'is_down_stat_by_user': 'Down by User',
|
31 |
|
|
'is_down_stat_by_ip': 'Down by Ip',
|
32 |
|
|
'is_down_stat_by_country': 'Down by Country',
|
33 |
|
|
'is_down_stat_by_months': 'Down by Month',
|
34 |
|
|
'is_down_stat_by_project': 'Down by Project',
|
35 |
|
|
'is_just_down_stat': 'Just Down',
|
36 |
|
|
}
|
37 |
|
|
|
38 |
|
|
dateTimeOptions = {
|
39 |
|
|
'format': 'dd/mm/yyyy',
|
40 |
|
|
|
41 |
|
|
'minView': 2,
|
42 |
|
|
'maxView': 2,
|
43 |
|
|
'autoclose': True,
|
44 |
|
|
'clearBtn': 'true',
|
45 |
|
|
}
|
46 |
|
|
|
47 |
|
|
widgets = {
|
48 |
|
|
'all_date': forms.CheckboxInput(attrs={"onClick": 'checkIfAll()'}),
|
49 |
|
|
'period_date': forms.CheckboxInput(attrs={"onClick": 'checkIfPeriod()'}),
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
|
54 |
|
|
'application': forms.Select(attrs={"onClick": 'onChangeApp()'}),
|
55 |
|
|
} |