1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Refs #26796 -- Fixed ManyToManyField's limit_choices_to warning without a through model.

This commit is contained in:
Kevan Swanberg
2016-07-21 13:08:57 -04:00
committed by Tim Graham
parent d7a097265b
commit 17a0a6667c
2 changed files with 11 additions and 1 deletions

View File

@@ -176,6 +176,15 @@ class RelativeFieldTests(SimpleTestCase):
field = Model._meta.get_field('m2m')
self.assertEqual(field.check(from_model=Model), [])
def test_many_to_many_with_limit_choices_auto_created_no_warning(self):
class Model(models.Model):
name = models.CharField(max_length=20)
class ModelM2M(models.Model):
m2m = models.ManyToManyField(Model, limit_choices_to={'name': 'test_name'})
self.assertEqual(ModelM2M.check(), [])
def test_many_to_many_with_useless_options(self):
class Model(models.Model):
name = models.CharField(max_length=20)