mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
* 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.
This commit is contained in:
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user