Changes between Initial Version and Version 2 of Ticket #15326


Ignore:
Timestamp:
Feb 17, 2011, 6:57:04 AM (13 years ago)
Author:
Karen Tracey
Comment:

Fixed formatting. Please use WikiFormatting and preview before posting.

This is the same problem as #13091, I believe, so closing as a dup of that one.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #15326

    • Property Cc Lior Sion added
    • Property Resolutionduplicate
    • Property Status newclosed
  • Ticket #15326 – Description

    initial v2  
    66
    77So:
    8 
     8{{{
    99class H(models.Model):
    1010    ....
     
    1717    class Meta:
    1818        unique_together = (("color", "house"),)
    19 
     19}}}
    2020And the form:
    21 
     21{{{
    2222class ChangeWindowForm(ModelForm):
    2323    class Meta:
    2424        model = W
    2525        fields = ('color', .... # other qualities)
    26 
     26}}}
    2727in this scenario, a form validation would pass if a H,C with the same values exist.
    2828
    2929The line that is the problem is in django.db.models.base.py, in def _get_unique_checks(self, exclude=None):
    30 
     30{{{
    3131if name in exclude:
    3232    break
    33 
     33}}}
    3434a possible change:
     35{{{
    3536if any(check[i:i + len(exclude)] == exclude for i in range(len(check) - len(exclude) + 1)):
    3637    break
     38}}}
Back to Top