|
@@ -4,7 +4,7 @@ from django.db import models
|
|
|
from django.test import TestCase
|
|
|
|
|
|
from .models import (
|
|
|
- First, Third, Parent, Child, Category, Record, Relation, Car, Driver)
|
|
|
+ First, Third, Parent, Child, ToFieldChild, Category, Record, Relation, Car, Driver)
|
|
|
|
|
|
|
|
|
class ManyToOneRegressionTests(TestCase):
|
|
@@ -67,10 +67,15 @@ class ManyToOneRegressionTests(TestCase):
|
|
|
|
|
|
p = Parent()
|
|
|
with self.assertRaisesMessage(ValueError,
|
|
|
- 'Cannot assign "%r": "%s" instance isn\'t saved in the database.'
|
|
|
- % (p, Child.parent.field.rel.to._meta.object_name)):
|
|
|
+ 'Cannot assign "%r": "%s" instance isn\'t saved in the database.'
|
|
|
+ % (p, Child.parent.field.rel.to._meta.object_name)):
|
|
|
Child(parent=p)
|
|
|
|
|
|
+ with self.assertRaisesMessage(ValueError,
|
|
|
+ 'Cannot assign "%r": "%s" instance isn\'t saved in the database.'
|
|
|
+ % (p, Child.parent.field.rel.to._meta.object_name)):
|
|
|
+ ToFieldChild(parent=p)
|
|
|
+
|
|
|
|
|
|
|
|
|
p = Parent.objects.get(name="Parent")
|