Fixed #25981 -- Added need to update migrations to on_delete deprecation warning.

This commit is contained in:
Luis San Pablo 2015-12-23 19:52:24 -06:00 committed by Tim Graham
parent 8b6974a685
commit a856555df2
2 changed files with 12 additions and 10 deletions

View File

@ -747,8 +747,9 @@ class ForeignKey(ForeignObject):
if on_delete is None: if on_delete is None:
warnings.warn( warnings.warn(
"on_delete will be a required arg for %s in Django 2.0. " "on_delete will be a required arg for %s in Django 2.0. Set "
"Set it to models.CASCADE if you want to maintain the current default behavior. " "it to models.CASCADE on models and in existing migrations "
"if you want to maintain the current default behavior. "
"See https://docs.djangoproject.com/en/%s/ref/models/fields/" "See https://docs.djangoproject.com/en/%s/ref/models/fields/"
"#django.db.models.ForeignKey.on_delete" % ( "#django.db.models.ForeignKey.on_delete" % (
self.__class__.__name__, self.__class__.__name__,
@ -977,8 +978,9 @@ class OneToOneField(ForeignKey):
if on_delete is None: if on_delete is None:
warnings.warn( warnings.warn(
"on_delete will be a required arg for %s in Django 2.0. " "on_delete will be a required arg for %s in Django 2.0. Set "
"Set it to models.CASCADE if you want to maintain the current default behavior. " "it to models.CASCADE on models and in existing migrations "
"if you want to maintain the current default behavior. "
"See https://docs.djangoproject.com/en/%s/ref/models/fields/" "See https://docs.djangoproject.com/en/%s/ref/models/fields/"
"#django.db.models.ForeignKey.on_delete" % ( "#django.db.models.ForeignKey.on_delete" % (
self.__class__.__name__, self.__class__.__name__,

View File

@ -53,9 +53,9 @@ class RelativeFieldTests(IsolatedModelsTestCase):
self.assertEqual( self.assertEqual(
str(warns[0].message), str(warns[0].message),
'on_delete will be a required arg for ForeignKey in Django ' 'on_delete will be a required arg for ForeignKey in Django '
'2.0. Set it to models.CASCADE if you want to maintain the ' '2.0. Set it to models.CASCADE on models and in existing '
'current default behavior. See ' 'migrations if you want to maintain the current default '
'https://docs.djangoproject.com/en/%s/ref/models/fields/' 'behavior. See https://docs.djangoproject.com/en/%s/ref/models/fields/'
'#django.db.models.ForeignKey.on_delete' % get_docs_version(), '#django.db.models.ForeignKey.on_delete' % get_docs_version(),
) )
@ -90,9 +90,9 @@ class RelativeFieldTests(IsolatedModelsTestCase):
self.assertEqual( self.assertEqual(
str(warns[0].message), str(warns[0].message),
'on_delete will be a required arg for OneToOneField in Django ' 'on_delete will be a required arg for OneToOneField in Django '
'2.0. Set it to models.CASCADE if you want to maintain the ' '2.0. Set it to models.CASCADE on models and in existing '
'current default behavior. See ' 'migrations if you want to maintain the current default '
'https://docs.djangoproject.com/en/%s/ref/models/fields/' 'behavior. See https://docs.djangoproject.com/en/%s/ref/models/fields/'
'#django.db.models.ForeignKey.on_delete' % get_docs_version(), '#django.db.models.ForeignKey.on_delete' % get_docs_version(),
) )