1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #17582 - Added message to DoesNotExist exceptions.

Thanks simon@ for the suggestion and JordanPowell
for the initial patch.
This commit is contained in:
Tim Graham
2013-05-24 13:30:37 -04:00
committed by Tim Graham
parent 37ea9f9c03
commit 6f8627dd7f
4 changed files with 15 additions and 3 deletions

View File

@@ -316,6 +316,11 @@ class MultiColumnFKTests(TestCase):
list(Article.objects.filter(active_translation__abstract=None)),
[a1, a2])
def test_foreign_key_raises_informative_does_not_exist(self):
referrer = ArticleTranslation()
with self.assertRaisesMessage(Article.DoesNotExist, 'ArticleTranslation has no article'):
referrer.article
class FormsTests(TestCase):
# ForeignObjects should not have any form fields, currently the user needs
# to manually deal with the foreignobject relation.