Added sog filters in HistoryForm
authorJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Sun, 17 Apr 2011 10:46:33 +0000 (10:46 +0000)
committerJean-Michel Nirgal Vourgère <jmv@nirgal.com>
Sun, 17 Apr 2011 10:46:33 +0000 (10:46 +0000)
bin/djais/views.py

index bc59cfddc066d0711ccd469dc8bd3dcfd6ec02dd..7e0701f5fe646b2b08a6db99d69427e7366f55c5 100644 (file)
@@ -173,6 +173,8 @@ class HistoryForm(forms.Form):
     grain = SecondsField(label='One position every', initial=3600)
     filter_area = forms.ChoiceField(required=False, label='Only in area',
         choices=[ (u'', u'(Not filtered)') ] + [ (fn[1], fn[0]) for fn in list_areas() ] )
+    filter_sog_le = forms.FloatField(required=False, label=u'Only if speed ≤ (knots)')
+    filter_sog_ge = forms.FloatField(required=False, label=u'Only if speed ≥ (knots)')
 
     def clean_start_date(self):
         period_type = self.cleaned_data.get('period_type', None)
@@ -249,6 +251,14 @@ class HistoryForm(forms.Form):
         if filter_area:
             command += u' --filter-area \'' + filter_area + u'\''
 
+        filter_sog_le = data.get('filter_sog_le', None)
+        if filter_area:
+            command += u' --filter_sog_le ' + unicode(filter_sog_le)
+
+        filter_sog_ge = data.get('filter_sog_ge', None)
+        if filter_area:
+            command += u' --filter_sog_ge ' + unicode(filter_sog_ge)
+
         return command, extension