Ticket #5794: widgetpatch.diff

File widgetpatch.diff, 585 bytes (added by MikeH <mike@…>, 8 years ago)

Detects for None when rendering

  • newforms/widgets.py

     
    161161            self.format = format
    162162
    163163    def render(self, name, value, attrs=None):
     164        if value is not None:
     165            value = value.strftime(self.format)
    164166        return super(DateTimeInput, self).render(name,
    165                 value.strftime(self.format), attrs)
     167                value, attrs)
    166168
    167169class CheckboxInput(Widget):
    168170    def __init__(self, attrs=None, check_test=bool):
Back to Top