Comments (0)

Files changed (3)

File CHANGELOG.txt Modified

View file
  • Ignore whitespace
  • Hide word diff
 1.3.6
 -----
 
-* fix issues 150, 151
+* fix issues 150, 151, 153
 
 1.3.5
 -----

File formalchemy/fields.py Modified

View file
  • Ignore whitespace
  • Hide word diff
         mm_name = self.name + '__month'
         dd_name = self.name + '__day'
         yyyy_name = self.name + '__year'
-        mm = _ternary((data is not None and mm_name in data), lambda: data[mm_name],  lambda: str(self.field.model_value and self.field.model_value.month))
-        dd = _ternary((data is not None and dd_name in data), lambda: data[dd_name], lambda: str(self.field.model_value and self.field.model_value.day))
+        mm = _ternary((data is not None and mm_name in data), lambda: data[mm_name][-1],  lambda: str(self.field.model_value and self.field.model_value.month))
+        dd = _ternary((data is not None and dd_name in data), lambda: data[dd_name][-1], lambda: str(self.field.model_value and self.field.model_value.day))
         # could be blank so don't use and/or construct
         if data is not None and yyyy_name in data:
             yyyy = data[yyyy_name]
         ss_name = self.name + '__second'
         is_time_type = isinstance(self.field.model_value, (datetime.datetime, datetime.date, datetime.time))
         hh = _ternary((data is not None and hh_name in data),
-                       lambda: data[hh_name],
+                       lambda: data[hh_name][-1],
                        lambda: str(is_time_type and self.field.model_value.hour))
         mm = _ternary((data is not None and mm_name in data),
-                       lambda: data[mm_name],
+                       lambda: data[mm_name][-1],
                        lambda: str(is_time_type and self.field.model_value.minute))
         ss = _ternary((data is not None and ss_name in data),
-                       lambda: data[ss_name],
+                       lambda: data[ss_name][-1],
                        lambda: str(is_time_type and self.field.model_value.second))
         return h.literal(':').join([
                     h.select(hh_name, [hh], hour_options, **kwargs),

File formalchemy/tests/test_dates.py Modified

View file
  • Ignore whitespace
  • Hide word diff
   </option>
  </select>
  <select id="Dt--foo__day" name="Dt--foo__day">
-  <option selected="selected" value="DD">
+  <option value="DD">
    Day
   </option>
   <option value="1">
 >>> print pretty_html(fs.bar.render())
 <span id="Dt--bar">
  <select id="Dt--bar__hour" name="Dt--bar__hour">
-  <option selected="selected" value="HH">
+  <option value="HH">
    HH
   </option>
   <option value="0">