Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions django/db/models/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -1475,6 +1475,18 @@ def values_list(self, *fields, flat=False, named=False):
"field."
)
elif not fields:
# RemovedInDjango70Warning: When the deprecation ends, replace
# with:
# raise TypeError(
# "'flat' is not valid when values_list is called with no "
# "fields."
# )
warnings.warn(
"Calling values_list() with no field name and flat=True "
"is deprecated. Pass an explicit field name instead, like "
"'pk'.",
RemovedInDjango70Warning,
)
fields = [self.model._meta.concrete_fields[0].attname]

field_names = {f: False for f in fields if not hasattr(f, "resolve_expression")}
Expand Down
3 changes: 2 additions & 1 deletion docs/internals/deprecation.txt
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ details on these changes.
See the :ref:`Django 6.1 release notes <deprecated-features-6.1>` for more
details on these changes.

* ...
* Calling :meth:`.QuerySet.values_list` with ``flat=True`` and no field name
will raise ``TypeError``.

.. _deprecation-removed-in-6.1:

Expand Down
4 changes: 3 additions & 1 deletion docs/releases/6.1.txt
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,9 @@ Features deprecated in 6.1
Miscellaneous
-------------

* ...
* Calling :meth:`.QuerySet.values_list` with ``flat=True`` and no field name
is deprecated. Pass an explicit field name, like
``values_list("pk", flat=True)``.

Features removed in 6.1
=======================
Expand Down
85 changes: 85 additions & 0 deletions eslint-recommended.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
/* https://github.com/eslint/eslint/blob/v9.36.0/packages/js/src/configs/eslint-recommended.js */

/**
* @fileoverview Configuration applied when a user configuration extends from
* eslint:recommended.
* @author Nicholas C. Zakas
*/

"use strict";

/* eslint sort-keys: ["error", "asc"] -- Long, so make more readable */

/*
* IMPORTANT!
*
* We cannot add a "name" property to this object because it's still used in eslintrc
* which doesn't support the "name" property. If we add a "name" property, it will
* cause an error.
*/

module.exports = Object.freeze({
rules: Object.freeze({
"constructor-super": "error",
"for-direction": "error",
"getter-return": "error",
"no-async-promise-executor": "error",
"no-case-declarations": "error",
"no-class-assign": "error",
"no-compare-neg-zero": "error",
"no-cond-assign": "error",
"no-const-assign": "error",
"no-constant-binary-expression": "error",
"no-constant-condition": "error",
"no-control-regex": "error",
"no-debugger": "error",
"no-delete-var": "error",
"no-dupe-args": "error",
"no-dupe-class-members": "error",
"no-dupe-else-if": "error",
"no-dupe-keys": "error",
"no-duplicate-case": "error",
"no-empty": "error",
"no-empty-character-class": "error",
"no-empty-pattern": "error",
"no-empty-static-block": "error",
"no-ex-assign": "error",
"no-extra-boolean-cast": "error",
"no-fallthrough": "error",
"no-func-assign": "error",
"no-global-assign": "error",
"no-import-assign": "error",
"no-invalid-regexp": "error",
"no-irregular-whitespace": "error",
"no-loss-of-precision": "error",
"no-misleading-character-class": "error",
"no-new-native-nonconstructor": "error",
"no-nonoctal-decimal-escape": "error",
"no-obj-calls": "error",
"no-octal": "error",
"no-prototype-builtins": "error",
"no-redeclare": "error",
"no-regex-spaces": "error",
"no-self-assign": "error",
"no-setter-return": "error",
"no-shadow-restricted-names": "error",
"no-sparse-arrays": "error",
"no-this-before-super": "error",
"no-undef": "error",
"no-unexpected-multiline": "error",
"no-unreachable": "error",
"no-unsafe-finally": "error",
"no-unsafe-negation": "error",
"no-unsafe-optional-chaining": "error",
"no-unused-labels": "error",
"no-unused-private-class-members": "error",
"no-unused-vars": "error",
"no-useless-backreference": "error",
"no-useless-catch": "error",
"no-useless-escape": "error",
"no-with": "error",
"require-yield": "error",
"use-isnan": "error",
"valid-typeof": "error",
}),
});
6 changes: 3 additions & 3 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import globals from "globals";
import js from "@eslint/js";
import globals from "./globals.js";
import recommended from "./eslint-recommended.js";

export default [
js.configs.recommended,
recommended,
{
files: ["**/*.js"],
rules: {
Expand Down
Loading