Models._get_unique_checks() does not return grandparents' unique checks
Consider the following models:
class Project(models.Model):
title = models.CharField(max_length=255)
internal_id = models.CharField(max_length=255, unique=True)
class SubProject(Project):
# ... fields of SubProject ...
pass
class SubSubProject(SubProject):
# ... fields of SubSubProject ...
pass
Following code works as expected (b.full_clean() throws a ValidationError):
a = SubProject( title = 'A', internal_id = 1 )
a.save()
b = SubProject( title = 'B', internal_id = 1 )
b.full_clean() # Throws ValidationError
Following code does not work as expected (b.full_clean() does not throw an exception, b.save() throws an IntegrityError):
a = SubSubProject( title = 'A', internal_id = 2 )
a.save()
b = SubSubProject( title = 'B', internal_id = 2 )
b.full_clean() # Does not throw any exception!
b.save() # Throws IntegrityError, of course!
Triage Stage: |
Unreviewed → Accepted
|
Owner: |
changed from nobody to sswang
|
Severity: |
→ Normal
|
Type: |
→ Bug
|
Easy pickings: |
unset
|
Patch needs improvement: |
set
|
UI/UX: |
unset
|
Owner: |
changed from sswang to aron45
|
Resolution: |
→ fixed
|
Status: |
assigned → closed
|
Patch needs improvement: |
unset
|
Resolution: |
fixed
|
Status: |
closed → new
|
Needs tests: |
set
|
Patch needs improvement: |
set
|
Version: |
1.2 → master
|
Needs tests: |
unset
|
Patch needs improvement: |
unset
|
Triage Stage: |
Accepted → Ready for checkin
|
Resolution: |
→ fixed
|
Status: |
new → closed
|
fix for sub sub inheritance uniqueness