mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #23338 -- Added warning when unique=True on ForeigKey
Thanks Jonathan Lindén for the initial patch, and Tim Graham and Gabe Jackson for the suggestions.
This commit is contained in:
parent
abf87333a1
commit
f39b0421b4
8 changed files with 54 additions and 4 deletions
|
@ -3,6 +3,7 @@ from django.core.checks import run_checks, Error
|
|||
from django.db.models.signals import post_init
|
||||
from django.test import TestCase
|
||||
from django.utils import six
|
||||
from django.test.utils import override_settings
|
||||
|
||||
|
||||
class OnPostInit(object):
|
||||
|
@ -14,6 +15,10 @@ def on_post_init(**kwargs):
|
|||
pass
|
||||
|
||||
|
||||
@override_settings(
|
||||
INSTALLED_APPS=['django.contrib.auth', 'django.contrib.contenttypes'],
|
||||
SILENCED_SYSTEM_CHECKS=['fields.W342'], # ForeignKey(unique=True)
|
||||
)
|
||||
class ModelValidationTest(TestCase):
|
||||
def test_models_validate(self):
|
||||
# All our models should validate properly
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue