summaryrefslogtreecommitdiff
path: root/tests/admin_widgets/models.py
diff options
context:
space:
mode:
authorJohannes Maron <info@johanneshoppe.com>2021-01-12 11:37:38 +0100
committerGitHub <noreply@github.com>2021-01-12 11:37:38 +0100
commit3071660acfbdf4b5c59457c8e9dc345d5e8894c5 (patch)
tree78b95d329ff10f4e0cd1c7b4d237d78c29b0d0bb /tests/admin_widgets/models.py
parentba3fb2e4d0aca26f6ea37d7e31488ad09043f89d (diff)
Fixed #29010, Fixed #29138 -- Added limit_choices_to and to_field support to autocomplete fields.
* Fixed #29010 -- Added limit_choices_to support to autocomplete fields. * Fixed #29138 -- Allowed autocomplete fields to target a custom to_field rather than the PK.
Diffstat (limited to 'tests/admin_widgets/models.py')
-rw-r--r--tests/admin_widgets/models.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/admin_widgets/models.py b/tests/admin_widgets/models.py
index 88bf2b8fca..85f71749fd 100644
--- a/tests/admin_widgets/models.py
+++ b/tests/admin_widgets/models.py
@@ -19,6 +19,7 @@ class Member(models.Model):
class Band(models.Model):
+ uuid = models.UUIDField(unique=True, default=uuid.uuid4)
name = models.CharField(max_length=100)
style = models.CharField(max_length=20)
members = models.ManyToManyField(Member)
@@ -36,7 +37,7 @@ class UnsafeLimitChoicesTo(models.Model):
class Album(models.Model):
- band = models.ForeignKey(Band, models.CASCADE)
+ band = models.ForeignKey(Band, models.CASCADE, to_field='uuid')
featuring = models.ManyToManyField(Band, related_name='featured')
name = models.CharField(max_length=100)
cover_art = models.FileField(upload_to='albums')