Exemplo n.º 1
0
 def render(self, name, value, attrs=None):
     if self.js_format_key is not None and self.options:
         js_format_string = get_format(self.js_format_key)
         self.options.update({
             'format': js_format_string,
             'language': get_language(),
         })
         self.format = datetime_format_js2py(js_format_string)
     return super(BaseL10NPicker, self).render(name=name, value=value, attrs=attrs)
Exemplo n.º 2
0
 def _format_value(self, value):
     js_format = self.options.get('format')
     self.format = datetime_format_js2py(js_format)
     return super(BaseL10NPicker, self)._format_value(value)
Exemplo n.º 3
0
 def to_native(self, value):
     if value is not None and self.format_key is not None:
         format_string = get_format(self.format_key)
         format = datetime_format_js2py(format_string)
         return value.strftime(format)
     return super(BaseL10NField, self).to_native(value)