Changes between Initial Version and Version 4 of Ticket #11765


Ignore:
Timestamp:
09/06/09 05:14:45 (13 years ago)
Author:
Karen Tracey
Comment:

Replying to mrts:

The problem is that DateField.to_python() (or DateTimeField) doesn't treat '' specially...

Neither does IntegerField nor FloatField, eg. It's not clear to me why Date fields would/should be singled out for special treatment here. Forms fields consistently handle treating empty strings input as None, but if you are operating at the model level then you need to use None when you mean None, not an empty string.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #11765

    • Property Status changed from new to closed
    • Property Component changed from Uncategorized to Database layer (models, ORM)
    • Property Needs tests set
    • Property Summary changed from models.DateField(null=True, blank=True) accepts None, but not null string '' to models.DateField(null=True, blank=True) accepts None, but not the empty string ''
    • Property Version changed from 1.1 to SVN
    • Property Resolution changed from to invalid
  • Ticket #11765 – Description

    initial v4  
    11For some reason I cannot create a record with
     2{{{
    23class MyModel(models.Model):
    34    models.DateField(null=True, blank=True)
    4 MyModel(MyDateField='')  It must be either None or a valid date.
     5MyModel(MyDateField='') 
     6}}}
     7It must be either None or a valid date.
    58
Back to Top