#11866: non-null FK to a CharField primary key fails when key value is the empty
string, giving "[model.fk_col] may not be NULL"
---------------------------------------------------+------------------------
          Reporter:  andrewbadr                    |         Owner:  andrewbadr
            Status:  new                           |     Milestone:            
         Component:  Database layer (models, ORM)  |       Version:  1.1       
        Resolution:                                |      Keywords:            
             Stage:  Unreviewed                    |     Has_patch:  0         
        Needs_docs:  0                             |   Needs_tests:  0         
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Changes (by andrewbadr):

  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * needs_docs:  => 0

Comment:

 Seems to be caused by `ForeignKey.get_db_prep_save` (called from
 `Model.save_base`):
 {{{
     def get_db_prep_save(self, value):
         if value == '' or value == None:
             return None
         ...
 }}}

 Unsure where to go since I don't know the reasoning behind this code. Is
 this due to forms assigning the empty-string to fields left blank?

-- 
Ticket URL: <http://code.djangoproject.com/ticket/11866#comment:1>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to