| | 23 | |
| | 24 | It might be worth adding a test with a model where pk fields are not defined next to each other or just alter the existing models to cover for that |
| | 25 | |
| | 26 | {{{#!diff |
| | 27 | diff --git a/tests/composite_pk/models/tenant.py b/tests/composite_pk/models/tenant.py |
| | 28 | index c85869afa7..a8dfd790f6 100644 |
| | 29 | --- a/tests/composite_pk/models/tenant.py |
| | 30 | +++ b/tests/composite_pk/models/tenant.py |
| | 31 | @@ -17,6 +17,7 @@ class Token(models.Model): |
| | 32 | class BaseModel(models.Model): |
| | 33 | pk = models.CompositePrimaryKey("tenant_id", "id") |
| | 34 | tenant = models.ForeignKey(Tenant, on_delete=models.CASCADE) |
| | 35 | + between = models.IntegerField(null=True) |
| | 36 | id = models.SmallIntegerField(unique=True) |
| | 37 | |
| | 38 | class Meta: |
| | 39 | @@ -34,8 +35,8 @@ class Comment(models.Model): |
| | 40 | on_delete=models.CASCADE, |
| | 41 | related_name="comments", |
| | 42 | ) |
| | 43 | - id = models.SmallIntegerField(unique=True, db_column="comment_id") |
| | 44 | user_id = models.SmallIntegerField() |
| | 45 | + id = models.SmallIntegerField(unique=True, db_column="comment_id") |
| | 46 | user = models.ForeignObject( |
| | 47 | User, |
| | 48 | on_delete=models.CASCADE, |
| | 49 | }}} |