app/soc/views/helper/forms.py
changeset 1451 ef134d062b83
parent 1360 f62c462037b6
child 1783 a456d120c902
--- a/app/soc/views/helper/forms.py	Sat Feb 21 23:36:39 2009 +0000
+++ b/app/soc/views/helper/forms.py	Sun Feb 22 00:27:10 2009 +0000
@@ -49,6 +49,8 @@
   ugettext() proxies used for internationalization in the Model will
   still work correctly with this new behavior, as long as the original
   strings are used as the translation keys.
+
+  Also set class date-pick or datetime-pick for DateField or DateTimeField.
   """
 
   def __init__(self, *args, **kwargs):
@@ -77,6 +79,12 @@
         if hasattr(model_prop, 'group'):
           self.fields[field_name].group = model_prop.group
 
+      if isinstance(self.fields[field_name], forms.DateField):
+        self.fields[field_name].widget.attrs['class'] = 'date-pick'
+
+      if isinstance(self.fields[field_name], forms.DateTimeField):
+        self.fields[field_name].widget.attrs['class'] = 'datetime-pick'
+
 
 class SelectQueryArgForm(forms.Form):
   """URL query argument change control implemented as a Django form.