Code

Ticket #12016: timefield_check_for_none_fix.patch

File timefield_check_for_none_fix.patch, 819 bytes (added by timkersten, 5 years ago)
  • django/contrib/admin/templatetags/admin_list.py

     
    183183                    result_repr = EMPTY_CHANGELIST_VALUE 
    184184            # Dates and times are special: They're formatted in a certain way. 
    185185            elif isinstance(f, models.DateField) or isinstance(f, models.TimeField): 
    186                 if field_val: 
     186                if field_val is not None: 
    187187                    (date_format, datetime_format, time_format) = get_date_formats() 
    188188                    if isinstance(f, models.DateTimeField): 
    189189                        result_repr = capfirst(dateformat.format(field_val, datetime_format))