Loading django/db/models/sql/query.py +2 −0 Original line number Diff line number Diff line Loading @@ -1121,6 +1121,8 @@ class Query(object): query. However, if the filter isn't added to the query then the caller is responsible for unreffing the joins used. """ if isinstance(filter_expr, dict): raise FieldError("Cannot parse keyword query as dict") arg, value = filter_expr if not arg: raise FieldError("Cannot parse keyword query %r" % arg) Loading tests/queries/tests.py +4 −0 Original line number Diff line number Diff line Loading @@ -440,6 +440,10 @@ class Queries1Tests(BaseQuerysetTest): ['<Item: four>'] ) def test_error_raised_on_filter_with_dictionary(self): with self.assertRaisesMessage(FieldError, 'Cannot parse keyword query as dict'): Note.objects.filter({'note': 'n1', 'misc': 'foo'}) def test_tickets_2076_7256(self): # Ordering on related tables should be possible, even if the table is # not otherwise involved. Loading Loading
django/db/models/sql/query.py +2 −0 Original line number Diff line number Diff line Loading @@ -1121,6 +1121,8 @@ class Query(object): query. However, if the filter isn't added to the query then the caller is responsible for unreffing the joins used. """ if isinstance(filter_expr, dict): raise FieldError("Cannot parse keyword query as dict") arg, value = filter_expr if not arg: raise FieldError("Cannot parse keyword query %r" % arg) Loading
tests/queries/tests.py +4 −0 Original line number Diff line number Diff line Loading @@ -440,6 +440,10 @@ class Queries1Tests(BaseQuerysetTest): ['<Item: four>'] ) def test_error_raised_on_filter_with_dictionary(self): with self.assertRaisesMessage(FieldError, 'Cannot parse keyword query as dict'): Note.objects.filter({'note': 'n1', 'misc': 'foo'}) def test_tickets_2076_7256(self): # Ordering on related tables should be possible, even if the table is # not otherwise involved. Loading