Changes between Initial Version and Version 4 of Ticket #11765


Ignore:
Timestamp:
Sep 6, 2009, 12:14:45 AM (15 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 Summary models.DateField(null=True, blank=True) accepts None, but not null string ''models.DateField(null=True, blank=True) accepts None, but not the empty string ''
    • Property Component UncategorizedDatabase layer (models, ORM)
    • Property Needs tests set
    • Property Version 1.1SVN
    • Property Resolutioninvalid
    • Property Status newclosed
  • 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