Changes between Initial Version and Version 2 of Ticket #15326
- Timestamp:
- Feb 17, 2011, 6:57:04 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #15326
- Property Cc added
- Property Resolution → duplicate
- Property Status new → closed
-
Ticket #15326 – Description
initial v2 6 6 7 7 So: 8 8 {{{ 9 9 class H(models.Model): 10 10 .... … … 17 17 class Meta: 18 18 unique_together = (("color", "house"),) 19 19 }}} 20 20 And the form: 21 21 {{{ 22 22 class ChangeWindowForm(ModelForm): 23 23 class Meta: 24 24 model = W 25 25 fields = ('color', .... # other qualities) 26 26 }}} 27 27 in this scenario, a form validation would pass if a H,C with the same values exist. 28 28 29 29 The line that is the problem is in django.db.models.base.py, in def _get_unique_checks(self, exclude=None): 30 30 {{{ 31 31 if name in exclude: 32 32 break 33 33 }}} 34 34 a possible change: 35 {{{ 35 36 if any(check[i:i + len(exclude)] == exclude for i in range(len(check) - len(exclude) + 1)): 36 37 break 38 }}}