mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +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:
parent
cbe4d6203f
commit
11e327a3ff
8 changed files with 82 additions and 15 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue