Browse files

preserve ordering of start and end time filter controls

  • Loading branch information...
zbyte64 committed Feb 4, 2012
1 parent 3d9a6fc commit eedb90b3b38b4652a73503c664ab3ed7dadb8179
Showing with 3 additions and 1 deletion.
  1. +3 −1 reportengine/
@@ -6,6 +6,7 @@
from django import forms
from django.db import models
from django.utils.translation import ugettext as _
+from django.utils.datastructures import SortedDict
# TODO build register and lookup functions
# TODO figure out how to manage filters and actual request params, which aren't always 1-to-1 (e.g. datetime)
@@ -43,7 +44,8 @@ def get_fields(self):
ln=self.label or self.field_name
start=forms.CharField(label=_("%s From")%ln,required=False,widget=forms.DateTimeInput(attrs={'class': 'vDateField'}))
end=forms.CharField(label=_("%s To")%ln,required=False,widget=forms.DateTimeInput(attrs={'class': 'vDateField'}))
- return {"%s__gte"%self.field_name:start,"%s__lt"%self.field_name:end}
+ return SortedDict([("%s__gte"%self.field_name, start),
+ ("%s__lt"%self.field_name, end),])
FilterControl.register(lambda m: isinstance(m,models.DateTimeField),DateTimeFilterControl,"datetime")

0 comments on commit eedb90b

Please sign in to comment.