#9218: KeyError in validate_unique when primary_key is in fields and it's empty 
in
form
-----------------------------------------------+----------------------------
          Reporter:  romke <[EMAIL PROTECTED]>  |         Owner:  nobody        
                               
            Status:  new                       |     Milestone:                 
                              
         Component:  Forms                     |       Version:  SVN            
                              
        Resolution:                            |      Keywords:  KeyError, 
validate_unique, custom primary_key
             Stage:  Unreviewed                |     Has_patch:  1              
                              
        Needs_docs:  0                         |   Needs_tests:  1              
                              
Needs_better_patch:  1                         |  
-----------------------------------------------+----------------------------
Changes (by mtredinnick):

  * needs_better_patch:  0 => 1
  * needs_tests:  0 => 1

Comment:

 I think this could be better written as `self.cleaned_data.get(name)`,
 since that will return `None` when it's missing (and the following line
 won't execute if the name is missing from cleaned_data. So the code is a
 bit simpler.

 Also, this should really have a test to make sure we don't reintroduce the
 problem. There's a regression tests file in the forms test directory.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9218#comment:2>
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