mirror of
https://github.com/django/django.git
synced 2025-10-24 14:16:09 +00:00
Fixed #30988 -- Deprecated the InvalidQuery exception.
It was barely documented without pointers at its defining location and was abused to prevent misuse of the QuerySet field deferring feature.
This commit is contained in:
committed by
Mariusz Felisiak
parent
cbe4d6203f
commit
11e327a3ff
@@ -1,8 +1,8 @@
|
||||
from datetime import date
|
||||
from decimal import Decimal
|
||||
|
||||
from django.core.exceptions import FieldDoesNotExist
|
||||
from django.db.models.query import RawQuerySet
|
||||
from django.db.models.query_utils import InvalidQuery
|
||||
from django.test import TestCase, skipUnlessDBFeature
|
||||
|
||||
from .models import (
|
||||
@@ -235,7 +235,8 @@ class RawQueryTests(TestCase):
|
||||
|
||||
def test_missing_fields_without_PK(self):
|
||||
query = "SELECT first_name, dob FROM raw_query_author"
|
||||
with self.assertRaisesMessage(InvalidQuery, 'Raw query must include the primary key'):
|
||||
msg = 'Raw query must include the primary key'
|
||||
with self.assertRaisesMessage(FieldDoesNotExist, msg):
|
||||
list(Author.objects.raw(query))
|
||||
|
||||
def test_annotations(self):
|
||||
|
||||
Reference in New Issue
Block a user