#8795: unique_together validation fails on model forms that exclude unique 
fields
----------------------------------------+-----------------------------------
          Reporter:  [EMAIL PROTECTED]  |         Owner:  jacob
            Status:  closed             |     Milestone:  1.0  
         Component:  Forms              |       Version:  SVN  
        Resolution:  fixed              |      Keywords:       
             Stage:  Accepted           |     Has_patch:  0    
        Needs_docs:  0                  |   Needs_tests:  0    
Needs_better_patch:  0                  |  
----------------------------------------+-----------------------------------
Comment (by oliverandrich):

 A question concerning the fix.

 Given a model like that:

 {{{
 class Project(models.Model):
     name         = models.CharField(_('Name'), max_length=255)
     creator      = models.ForeignKey(User, verbose_name=_('Ersteller'),
 related_name='projects')

     class Meta:
         unique_together     = ('name', 'creator')
 }}}

 And a form like that:

 {{{
 class ProjectForm(forms.ModelForm):
     class Meta:
         model   = Project
         fields  = ['name']
 }}}

 form.is_valid() doesn't report the failed constraint, only when I include
 in the creator field in the fields array too. Seems as the check is broken
 (or impossible), if only one part of the unique_together constraint is
 inside the fields list.

 Is this a bug or just a case I have to live with, cause it is not
 solvable?

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