mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
Fixed #11707 - limit_choices_to on a ForeignKey can render duplicate options in formfield
Thanks to Chris Wesseling for the report and patch. git-svn-id: http://code.djangoproject.com/svn/django/trunk@15607 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
@@ -29,6 +29,11 @@ class Bar(models.Model):
|
||||
b = models.CharField(max_length=10)
|
||||
a = models.ForeignKey(Foo, default=get_foo)
|
||||
|
||||
class Baz(models.Model):
|
||||
a = models.CharField(max_length=5)
|
||||
#Only Foos related to Bars starting with 'a'
|
||||
foo = models.ForeignKey(Foo, limit_choices_to=models.Q(bar__b__startswith='a'))
|
||||
|
||||
class Whiz(models.Model):
|
||||
CHOICES = (
|
||||
('Group 1', (
|
||||
|
||||
Reference in New Issue
Block a user