summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/modeladmin/test_checks.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/modeladmin/test_checks.py b/tests/modeladmin/test_checks.py
index eaca153bd8..5559a8fe3c 100644
--- a/tests/modeladmin/test_checks.py
+++ b/tests/modeladmin/test_checks.py
@@ -6,7 +6,9 @@ from django.core.checks import Error
from django.forms.models import BaseModelFormSet
from django.test import SimpleTestCase
-from .models import Band, Song, ValidationTestInlineModel, ValidationTestModel
+from .models import (
+ Band, Song, User, ValidationTestInlineModel, ValidationTestModel,
+)
class CheckTestCase(SimpleTestCase):
@@ -1243,3 +1245,14 @@ class AutocompleteFieldsTests(CheckTestCase):
site = AdminSite()
site.register(Band, SearchFieldsAdmin)
self.assertIsValid(AutocompleteAdmin, Song, admin_site=site)
+
+ def test_autocomplete_is_onetoone(self):
+ class UserAdmin(ModelAdmin):
+ search_fields = ('name', )
+
+ class Admin(ModelAdmin):
+ autocomplete_fields = ('best_friend', )
+
+ site = AdminSite()
+ site.register(User, UserAdmin)
+ self.assertIsValid(Admin, ValidationTestModel, admin_site=site)