parent
9108696a75
commit
b679a3cdb1
|
@ -1059,7 +1059,7 @@ class Query(object):
|
|||
if not value.is_compatible_query_object_type(opts, field):
|
||||
raise ValueError(
|
||||
'Cannot use QuerySet for "%s": Use a QuerySet for "%s".' %
|
||||
(value.model._meta.model_name, opts.object_name)
|
||||
(value.model._meta.object_name, opts.object_name)
|
||||
)
|
||||
elif hasattr(value, '_meta'):
|
||||
self.check_query_object_type(value, opts, field)
|
||||
|
|
|
@ -2969,6 +2969,11 @@ class QuerySetExceptionTests(TestCase):
|
|||
with self.assertRaisesMessage(FieldError, msg):
|
||||
list(Article.objects.order_by('*'))
|
||||
|
||||
def test_invalid_queryset_model(self):
|
||||
msg = 'Cannot use QuerySet for "Article": Use a QuerySet for "ExtraInfo".'
|
||||
with self.assertRaisesMessage(ValueError, msg):
|
||||
list(Author.objects.filter(extra=Article.objects.all()))
|
||||
|
||||
|
||||
class NullJoinPromotionOrTest(TestCase):
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in New Issue