instance_id stringlengths 20 32 | feedback stringlengths 5 167 ⌀ | Level stringclasses 11
values | erroneous_file stringlengths 21 51 | repo stringclasses 3
values | base_commit stringlengths 40 40 | patch stringlengths 386 3.07k | test_patch stringlengths 473 13.9k | problem_statement stringlengths 262 5.59k | hints_text stringlengths 0 9.06k | created_at stringlengths 20 20 | version stringclasses 14
values | FAIL_TO_PASS stringlengths 52 763 | PASS_TO_PASS stringlengths 2 31.4k | environment_setup_commit stringlengths 40 40 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
django__django-15202 | Retreival is straightford correct file is the last stacktrace that has valid path | null | django/core/validators.py | django/django | 4fd3044ca0135da903a70dfb66992293f529ecf1 | diff --git a/django/core/validators.py b/django/core/validators.py
--- a/django/core/validators.py
+++ b/django/core/validators.py
@@ -108,15 +108,16 @@ def __call__(self, value):
raise ValidationError(self.message, code=self.code, params={'value': value})
# Then check full URL
+ try:
+ ... | diff --git a/tests/forms_tests/field_tests/test_urlfield.py b/tests/forms_tests/field_tests/test_urlfield.py
--- a/tests/forms_tests/field_tests/test_urlfield.py
+++ b/tests/forms_tests/field_tests/test_urlfield.py
@@ -100,6 +100,10 @@ def test_urlfield_clean_invalid(self):
# even on domains that don't fai... | URLField throws ValueError instead of ValidationError on clean
Description
forms.URLField( ).clean('////]@N.AN')
results in:
ValueError: Invalid IPv6 URL
Traceback (most recent call last):
File "basic_fuzzer.py", line 22, in TestOneInput
File "fuzzers.py", line 350, in test_forms_URLField
File "django/forms/f... | 2021-12-15T15:04:13Z | 4.1 | ["test_urlfield_clean_invalid (forms_tests.field_tests.test_urlfield.URLFieldTest)", "test_urlfield_clean_not_required (forms_tests.field_tests.test_urlfield.URLFieldTest)"] | ["test_urlfield_clean (forms_tests.field_tests.test_urlfield.URLFieldTest)", "test_urlfield_clean_required (forms_tests.field_tests.test_urlfield.URLFieldTest)", "test_urlfield_strip_on_none_value (forms_tests.field_tests.test_urlfield.URLFieldTest)", "test_urlfield_unable_to_set_strip_kwarg (forms_tests.field_tests.te... | 647480166bfe7532e8c471fef0146e3a17e6c0c9 | |
django__django-17087 | Profile class is withinn many files but each has same neighbor and the neighbor of that neighbour is the actual file | 2nd level | django/db/migrations/serializer.py | django/django | 4a72da71001f154ea60906a2f74898d32b7322a7 | diff --git a/django/db/migrations/serializer.py b/django/db/migrations/serializer.py
--- a/django/db/migrations/serializer.py
+++ b/django/db/migrations/serializer.py
@@ -168,7 +168,7 @@ def serialize(self):
):
klass = self.value.__self__
module = klass.__module__
- return ... | diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py
--- a/tests/migrations/test_writer.py
+++ b/tests/migrations/test_writer.py
@@ -211,6 +211,10 @@ class NestedChoices(models.TextChoices):
X = "X", "X value"
Y = "Y", "Y value"
+ @classmethod
+ def method(cls... | Class methods from nested classes cannot be used as Field.default.
Description
(last modified by Mariusz Felisiak)
Given the following model:
class Profile(models.Model):
class Capability(models.TextChoices):
BASIC = ("BASIC", "Basic")
PROFESSIONAL = ("PROFESSIONAL", "Professional")
@classmethod
d... | Thanks for the report. It seems that FunctionTypeSerializer should use __qualname__ instead of __name__: django/db/migrations/serializer.py diff --git a/django/db/migrations/serializer.py b/django/db/migrations/serializer.py index d88cda6e20..06657ebaab 100644 a b class FunctionTypeSerializer(BaseSerializer): 168168 ):... | 2023-07-17T20:28:41Z | 5.0 | ["test_serialize_nested_class_method (migrations.test_writer.WriterTests.test_serialize_nested_class_method)"] | ["test_args_kwargs_signature (migrations.test_writer.OperationWriterTests.test_args_kwargs_signature)", "test_args_signature (migrations.test_writer.OperationWriterTests.test_args_signature)", "test_empty_signature (migrations.test_writer.OperationWriterTests.test_empty_signature)", "test_expand_args_signature (migrati... | 4a72da71001f154ea60906a2f74898d32b7322a7 |
django__django-14017 | Retreival is straightford correct file is the last stacktrace that has valid path | null | django/db/models/query_utils.py | django/django | 466920f6d726eee90d5566e0a9948e92b33a122e | diff --git a/django/db/models/query_utils.py b/django/db/models/query_utils.py
--- a/django/db/models/query_utils.py
+++ b/django/db/models/query_utils.py
@@ -40,7 +40,7 @@ def __init__(self, *args, _connector=None, _negated=False, **kwargs):
super().__init__(children=[*args, *sorted(kwargs.items())], connecto... | diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -815,6 +815,28 @@ def test_boolean_expression_combined(self):
Employee.objects.filter(Exists(is_poc) | Q(salary__lt=15)),
[self.example_inc.ceo, self.max],
... | Q(...) & Exists(...) raises a TypeError
Description
Exists(...) & Q(...) works, but Q(...) & Exists(...) raise a TypeError
Here's a minimal example:
In [3]: Exists(Product.objects.all()) & Q()
Out[3]: <Q: (AND: <django.db.models.expressions.Exists object at 0x7fc18dd0ed90>, (AND: ))>
In [4]: Q() & Exists(Product.obje... | Reproduced on 3.1.6. The exception is raised by this two lines in the Q._combine, which are not present in the Combinable._combine from which Exists inherit. if not isinstance(other, Q): raise TypeError(other)
Tests: diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py index 08ea0a51d3..20d0404f44 10064... | 2021-02-18T13:05:27Z | 4.0 | ["test_boolean_expression_combined (expressions.tests.BasicExpressionsTests)", "test_boolean_expression_combined_with_empty_Q (expressions.tests.BasicExpressionsTests)"] | ["test_resolve_output_field (expressions.tests.CombinedExpressionTests)", "test_deconstruct (expressions.tests.FTests)", "test_deepcopy (expressions.tests.FTests)", "test_equal (expressions.tests.FTests)", "test_hash (expressions.tests.FTests)", "test_not_equal_Value (expressions.tests.FTests)", "test_and (expressions.... | 475cffd1d64c690cdad16ede4d5e81985738ceb4 |
django__django-11422 | manage.py has only one neigbour __init__. but next posisbke file was runserver according to description then it was able t find it using first neighbour | 1st Level | django/utils/autoreload.py | django/django | df46b329e0900e9e4dc1d60816c1dce6dfc1094e | diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -114,7 +114,15 @@ def iter_modules_and_files(modules, extra_files):
# During debugging (with PyDev) the 'typing.io' and 'typing.re' objects
# are added to sys.modul... | diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py
--- a/tests/utils_tests/test_autoreload.py
+++ b/tests/utils_tests/test_autoreload.py
@@ -132,6 +132,10 @@ def test_module_without_spec(self):
del module.__spec__
self.assertEqual(autoreload.iter_modules_and_files... | Autoreloader with StatReloader doesn't track changes in manage.py.
Description
(last modified by Mariusz Felisiak)
This is a bit convoluted, but here we go.
Environment (OSX 10.11):
$ python -V
Python 3.6.2
$ pip -V
pip 19.1.1
$ pip install Django==2.2.1
Steps to reproduce:
Run a server python manage.py runserv... | Thanks for the report. I simplified scenario. Regression in c8720e7696ca41f3262d5369365cc1bd72a216ca. Reproduced at 8d010f39869f107820421631111417298d1c5bb9.
Argh. I guess this is because manage.py isn't showing up in the sys.modules. I'm not sure I remember any specific manage.py handling in the old implementation, so... | 2019-05-27T19:15:21Z | 3.0 | ["test_main_module_is_resolved (utils_tests.test_autoreload.TestIterModulesAndFiles)"] | ["test_watchman_available (utils_tests.test_autoreload.GetReloaderTests)", "test_watchman_unavailable (utils_tests.test_autoreload.GetReloaderTests)", "test_calls_start_django (utils_tests.test_autoreload.RunWithReloaderTests)", "test_calls_sys_exit (utils_tests.test_autoreload.RunWithReloaderTests)", "test_swallows_ke... | 419a78300f7cd27611196e1e464d50fd0385ff27 |
django__django-14915 | 2 files related to given function name | 1 | django/forms/models.py | django/django | 903aaa35e5ceaa33bfc9b19b7f6da65ce5a91dd4 | diff --git a/django/forms/models.py b/django/forms/models.py
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -1166,6 +1166,9 @@ def __init__(self, value, instance):
def __str__(self):
return str(self.value)
+ def __hash__(self):
+ return hash(self.value)
+
def __eq__(self, ot... | diff --git a/tests/model_forms/test_modelchoicefield.py b/tests/model_forms/test_modelchoicefield.py
--- a/tests/model_forms/test_modelchoicefield.py
+++ b/tests/model_forms/test_modelchoicefield.py
@@ -2,7 +2,7 @@
from django import forms
from django.core.exceptions import ValidationError
-from django.forms.models... | ModelChoiceIteratorValue is not hashable.
Description
Recently I migrated from Django 3.0 to Django 3.1. In my code, I add custom data-* attributes to the select widget options. After the upgrade some of those options broke. Error is {TypeError}unhashable type: 'ModelChoiceIteratorValue'.
Example (this one breaks):
... | Thanks for the ticket. Agreed, we could make ModelChoiceIteratorValue hashable by adding: def __hash__(self): return hash(self.value) For now you can use value.value as documented in the "Backwards incompatible changes in 3.1" section. Would you like to prepare a patch?
Replying to Mariusz Felisiak: Thanks for the tic... | 2021-09-29T22:00:15Z | 4.1 | ["test_choice_value_hash (model_forms.test_modelchoicefield.ModelChoiceFieldTests)"] | ["test_basics (model_forms.test_modelchoicefield.ModelChoiceFieldTests)", "test_choice_iterator_passes_model_to_widget (model_forms.test_modelchoicefield.ModelChoiceFieldTests)", "test_choices (model_forms.test_modelchoicefield.ModelChoiceFieldTests)", "test_choices_bool (model_forms.test_modelchoicefield.ModelChoiceFi... | 647480166bfe7532e8c471fef0146e3a17e6c0c9 |
django__django-15996 | Need to identify EnumSerializer as a function or a class | Level 0 | django/db/migrations/serializer.py | django/django | b30c0081d4d8a31ab7dc7f72a4c7099af606ef29 | diff --git a/django/db/migrations/serializer.py b/django/db/migrations/serializer.py
--- a/django/db/migrations/serializer.py
+++ b/django/db/migrations/serializer.py
@@ -16,7 +16,7 @@
from django.db.migrations.operations.base import Operation
from django.db.migrations.utils import COMPILED_REGEX_TYPE, RegexObject
f... | diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py
--- a/tests/migrations/test_writer.py
+++ b/tests/migrations/test_writer.py
@@ -413,6 +413,14 @@ def test_serialize_enum_flags(self):
"(2, migrations.test_writer.IntFlagEnum['B'])], "
"default=migrations.test_writer... | Support for serialization of combination of Enum flags.
Description
(last modified by Willem Van Onsem)
If we work with a field:
regex_flags = models.IntegerField(default=re.UNICODE | re.IGNORECASE)
This is turned into a migration with:
default=re.RegexFlag[None]
This is due to the fact that the EnumSerializer ... | patch of the EnumSerializer | 2022-08-25T04:49:14Z | 4.2 | ["test_serialize_enum_flags (migrations.test_writer.WriterTests)"] | ["test_args_kwargs_signature (migrations.test_writer.OperationWriterTests)", "test_args_signature (migrations.test_writer.OperationWriterTests)", "test_empty_signature (migrations.test_writer.OperationWriterTests)", "test_expand_args_signature (migrations.test_writer.OperationWriterTests)", "test_kwargs_signature (migr... | 0fbdb9784da915fce5dcc1fe82bac9b4785749e5 |
django__django-15252 | null | null | django/db/migrations/executor.py | django/django | 361bb8f786f112ee275be136795c0b1ecefff928 | diff --git a/django/db/migrations/executor.py b/django/db/migrations/executor.py
--- a/django/db/migrations/executor.py
+++ b/django/db/migrations/executor.py
@@ -96,8 +96,12 @@ def migrate(self, targets, plan=None, state=None, fake=False, fake_initial=False
(un)applied and in a second step run all the databas... | diff --git a/tests/backends/base/test_creation.py b/tests/backends/base/test_creation.py
--- a/tests/backends/base/test_creation.py
+++ b/tests/backends/base/test_creation.py
@@ -57,12 +57,12 @@ def test_custom_test_name_with_test_prefix(self):
@mock.patch.object(connection, 'ensure_connection')
@mock.patch.object(co... | MigrationRecorder does not obey db_router allow_migrate rules
Description
Hi,
We have a multi-db setup. We have one connection that is for the django project, and several connections that talk to other dbs for information (ie models with managed = False). Django should only create tables in the first connection, neve... | I don't think you've implemented your router correctly, but I'd need to check the router code to see if it's called multiple times (num_dbs*num_models) to be sure. This is how we implement our routers for allow_migrate: def allow_migrate(self, db, model): if db == 'other': return model._meta.app_label == 'legacy_app' #... | 2021-12-28T15:51:06Z | 4.1 | ["test_migrate_test_setting_false_ensure_schema (backends.base.test_creation.TestDbCreationTests)", "The django_migrations table is not created if there are no migrations"] | ["test_mark_expected_failures_and_skips (backends.base.test_creation.TestMarkTests)", "test_custom_test_name (backends.base.test_creation.TestDbSignatureTests)", "test_custom_test_name_with_test_prefix (backends.base.test_creation.TestDbSignatureTests)", "test_default_name (backends.base.test_creation.TestDbSignatureTe... | 647480166bfe7532e8c471fef0146e3a17e6c0c9 |
django__django-11797 | description of a file might be useful | 2 | django/db/models/lookups.py | django/django | 3346b78a8a872286a245d1e77ef4718fc5e6be1a | diff --git a/django/db/models/lookups.py b/django/db/models/lookups.py
--- a/django/db/models/lookups.py
+++ b/django/db/models/lookups.py
@@ -262,9 +262,9 @@ def process_rhs(self, compiler, connection):
from django.db.models.sql.query import Query
if isinstance(self.rhs, Query):
if self.... | diff --git a/tests/lookup/tests.py b/tests/lookup/tests.py
--- a/tests/lookup/tests.py
+++ b/tests/lookup/tests.py
@@ -5,6 +5,7 @@
from django.core.exceptions import FieldError
from django.db import connection
+from django.db.models import Max
from django.db.models.expressions import Exists, OuterRef
from django.... | Filtering on query result overrides GROUP BY of internal query
Description
from django.contrib.auth import models
a = models.User.objects.filter(email__isnull=True).values('email').annotate(m=Max('id')).values('m')
print(a.query) # good
# SELECT MAX("auth_user"."id") AS "m" FROM "auth_user" WHERE "auth_user"."email" ... | Workaround: from django.contrib.auth import models a = models.User.objects.filter(email__isnull=True).values('email').aggregate(Max('id'))['id_max'] b = models.User.objects.filter(id=a)
Thanks for tackling that one James! If I can provide you some guidance I'd suggest you have a look at lookups.Exact.process_rhs https... | 2019-09-20T02:23:19Z | 3.1 | ["test_exact_query_rhs_with_selected_columns (lookup.tests.LookupTests)"] | ["test_chain_date_time_lookups (lookup.tests.LookupTests)", "test_count (lookup.tests.LookupTests)", "test_custom_field_none_rhs (lookup.tests.LookupTests)", "Lookup.can_use_none_as_rhs=True allows None as a lookup value.", "test_error_messages (lookup.tests.LookupTests)", "test_escaping (lookup.tests.LookupTests)", "t... | 0668164b4ac93a5be79f5b87fae83c657124d9ab |
django__django-16046 | can understand exact file | 0 | django/utils/numberformat.py | django/django | ec13e801b820614ff374cb0046092caab8d67249 | diff --git a/django/utils/numberformat.py b/django/utils/numberformat.py
--- a/django/utils/numberformat.py
+++ b/django/utils/numberformat.py
@@ -25,6 +25,8 @@ def format(
module in locale.localeconv() LC_NUMERIC grouping (e.g. (3, 2, 0)).
* thousand_sep: Thousand separator symbol (for example ",")
... | diff --git a/tests/utils_tests/test_numberformat.py b/tests/utils_tests/test_numberformat.py
--- a/tests/utils_tests/test_numberformat.py
+++ b/tests/utils_tests/test_numberformat.py
@@ -172,3 +172,7 @@ def __format__(self, specifier, **kwargs):
price = EuroDecimal("1.23")
self.assertEqual(nformat(p... | Fix numberformat.py "string index out of range" when null
Description
When:
if str_number[0] == "-"
encounters a number field that's null when formatting for the admin list_display this causes an
IndexError: string index out of range
I can attach the proposed fix here, or open a pull request on GitHub if you like?
| proposed fix patch
Please provide a pull request, including a test. | 2022-09-10T13:27:38Z | 4.2 | ["test_empty (utils_tests.test_numberformat.TestNumberFormat)"] | ["test_decimal_numbers (utils_tests.test_numberformat.TestNumberFormat)", "test_decimal_subclass (utils_tests.test_numberformat.TestNumberFormat)", "test_float_numbers (utils_tests.test_numberformat.TestNumberFormat)", "test_format_number (utils_tests.test_numberformat.TestNumberFormat)", "test_format_string (utils_tes... | 0fbdb9784da915fce5dcc1fe82bac9b4785749e5 |
django__django-11583 | null | 2 | django/utils/autoreload.py | django/django | 60dc957a825232fdda9138e2f8878b2ca407a7c9 | diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -143,6 +143,10 @@ def iter_modules_and_files(modules, extra_files):
# The module could have been removed, don't fail loudly if this
# is the case.
... | diff --git a/tests/utils_tests/test_autoreload.py b/tests/utils_tests/test_autoreload.py
--- a/tests/utils_tests/test_autoreload.py
+++ b/tests/utils_tests/test_autoreload.py
@@ -140,6 +140,17 @@ def test_main_module_without_file_is_not_resolved(self):
fake_main = types.ModuleType('__main__')
self.ass... | Auto-reloading with StatReloader very intermittently throws "ValueError: embedded null byte".
Description
Raising this mainly so that it's tracked, as I have no idea how to reproduce it, nor why it's happening. It ultimately looks like a problem with Pathlib, which wasn't used prior to 2.2.
Stacktrace:
Traceback (mos... | Thanks for the report, however as you've admitted there is too many unknowns to accept this ticket. I don't believe that it is related with pathlib, maybe samba connection is unstable it's hard to tell.
I don't believe that it is related with pathlib Well ... it definitely is, you can see that from the stacktrace. The ... | 2019-07-21T20:56:14Z | 3.0 | ["test_path_with_embedded_null_bytes (utils_tests.test_autoreload.TestIterModulesAndFiles)", "test_paths_are_pathlib_instances (utils_tests.test_autoreload.TestIterModulesAndFiles)"] | ["test_no_exception (utils_tests.test_autoreload.TestRaiseLastException)", "test_raises_custom_exception (utils_tests.test_autoreload.TestRaiseLastException)", "test_raises_exception (utils_tests.test_autoreload.TestRaiseLastException)", "test_raises_exception_with_context (utils_tests.test_autoreload.TestRaiseLastExce... | 419a78300f7cd27611196e1e464d50fd0385ff27 |
django__django-15738 | need to identify issue is with migrate file | 1 | django/db/migrations/autodetector.py | django/django | 6f73eb9d90cfec684529aab48d517e3d6449ba8c | diff --git a/django/db/migrations/autodetector.py b/django/db/migrations/autodetector.py
--- a/django/db/migrations/autodetector.py
+++ b/django/db/migrations/autodetector.py
@@ -1022,8 +1022,9 @@ def generate_added_fields(self):
def _generate_added_field(self, app_label, model_name, field_name):
field ... | diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py
--- a/tests/migrations/test_autodetector.py
+++ b/tests/migrations/test_autodetector.py
@@ -868,6 +868,18 @@ class AutodetectorTests(TestCase):
"unique_together": {("title", "newfield2")},
},
)
+ boo... | Models migration with change field foreign to many and deleting unique together.
Description
(last modified by Simon Charette)
I have models like
class Authors(models.Model):
project_data_set = models.ForeignKey(
ProjectDataSet,
on_delete=models.PROTECT
)
state = models.IntegerField()
start_date = model... | Download this file and then do makemigrations and migrate to see this error.
Thanks for the report. Tentatively accepting, however I'm not sure if we can sort these operations properly, we should probably alter unique_together first migrations.AlterUniqueTogether( name='authors', unique_together=set(), ), migrations.Re... | 2022-05-27T13:20:14Z | 4.2 | ["test_alter_unique_together_fk_to_m2m (migrations.test_autodetector.AutodetectorTests)", "#23938 - Changing a ManyToManyField into a concrete field"] | ["test_auto (migrations.test_autodetector.MigrationSuggestNameTests)", "test_many_operations_suffix (migrations.test_autodetector.MigrationSuggestNameTests)", "test_no_operations (migrations.test_autodetector.MigrationSuggestNameTests)", "test_no_operations_initial (migrations.test_autodetector.MigrationSuggestNameTest... | 0fbdb9784da915fce5dcc1fe82bac9b4785749e5 |
django__django-12113 | within 1st neigbour of last one in stracktrace need to think about path of files also just than file name but can the LLM do that for us? | 1 | django/db/backends/sqlite3/creation.py | django/django | 62254c5202e80a68f4fe6572a2be46a3d953de1a | diff --git a/django/db/backends/sqlite3/creation.py b/django/db/backends/sqlite3/creation.py
--- a/django/db/backends/sqlite3/creation.py
+++ b/django/db/backends/sqlite3/creation.py
@@ -98,4 +98,6 @@ def test_db_signature(self):
sig = [self.connection.settings_dict['NAME']]
if self.is_in_memory_db(te... | diff --git a/tests/backends/sqlite/test_creation.py b/tests/backends/sqlite/test_creation.py
new file mode 100644
--- /dev/null
+++ b/tests/backends/sqlite/test_creation.py
@@ -0,0 +1,18 @@
+import copy
+import unittest
+
+from django.db import connection
+from django.test import SimpleTestCase
+
+
+@unittest.skipUnles... | admin_views.test_multidb fails with persistent test SQLite database.
Description
(last modified by Mariusz Felisiak)
I've tried using persistent SQLite databases for the tests (to make use of
--keepdb), but at least some test fails with:
sqlite3.OperationalError: database is locked
This is not an issue when onl... | This is only an issue when setting TEST["NAME"], but not NAME. The following works: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'django_tests_default.sqlite3', }, 'other': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': 'django_tests_other.sqlite3', } }
Reproduced at 0dd2308cf6f559a4f4b... | 2019-11-20T17:49:06Z | 3.1 | ["test_custom_test_name (backends.sqlite.test_creation.TestDbSignatureTests)"] | [] | 0668164b4ac93a5be79f5b87fae83c657124d9ab |
django__django-11620 | quite difficult to identify file as debug.py | null | django/views/debug.py | django/django | 514efa3129792ec2abb2444f3e7aeb3f21a38386 | diff --git a/django/views/debug.py b/django/views/debug.py
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -5,10 +5,10 @@
from pathlib import Path
from django.conf import settings
-from django.http import HttpResponse, HttpResponseNotFound
+from django.http import Http404, HttpResponse, HttpResponseNotFo... | diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
--- a/tests/view_tests/tests/test_debug.py
+++ b/tests/view_tests/tests/test_debug.py
@@ -12,11 +12,13 @@
from django.core import mail
from django.core.files.uploadedfile import SimpleUploadedFile
from django.db import DatabaseE... | When DEBUG is True, raising Http404 in a path converter's to_python method does not result in a technical response
Description
This is the response I get (plain text):
A server error occurred. Please contact the administrator.
I understand a ValueError should be raised which tells the URL resolver "this path does no... | It seems that other exceptions correctly result in a technical 500 response.
The technical_404_response view performs a new URL resolving (cf https://github.com/django/django/blob/a8e492bc81fca829f5d270e2d57703c02e58701e/django/views/debug.py#L482) which will obviously raise a new Http404 which won't be caught as only... | 2019-08-02T13:56:08Z | 3.0 | ["test_technical_404_converter_raise_404 (view_tests.tests.test_debug.DebugViewTests)"] | ["test_repr (view_tests.tests.test_debug.CallableSettingWrapperTests)", "test_cleanse_setting_basic (view_tests.tests.test_debug.HelperFunctionTests)", "test_cleanse_setting_ignore_case (view_tests.tests.test_debug.HelperFunctionTests)", "test_cleanse_setting_recurses_in_dictionary (view_tests.tests.test_debug.HelperFu... | 419a78300f7cd27611196e1e464d50fd0385ff27 |
django__django-16041 | need to identify that issue is with empty_form (file, function or class) | 0 | django/forms/formsets.py | django/django | 6df9398cce063874ae4d59db126d4adacb0fa8d3 | diff --git a/django/forms/formsets.py b/django/forms/formsets.py
--- a/django/forms/formsets.py
+++ b/django/forms/formsets.py
@@ -257,14 +257,15 @@ def extra_forms(self):
@property
def empty_form(self):
- form = self.form(
- auto_id=self.auto_id,
- prefix=self.add_prefix("__pre... | diff --git a/tests/forms_tests/tests/test_formsets.py b/tests/forms_tests/tests/test_formsets.py
--- a/tests/forms_tests/tests/test_formsets.py
+++ b/tests/forms_tests/tests/test_formsets.py
@@ -179,6 +179,10 @@ def test_form_kwargs_empty_form(self):
self.assertTrue(hasattr(formset.empty_form, "custom_kwarg"))... | Rendering empty_form crashes when empty_permitted is passed to form_kwargs
Description
Issue
When explicitly setting form_kwargs = {'empty_permitted':True} or form_kwargs = {'empty_permitted':False} , a KeyError occurs when rendering a template that uses a formset's empty_form.
Expected Behavior
empty_permitted is ig... | Thanks for the report. It should be enough to change form_kwargs for empty_form, e.g. django/forms/formsets.py diff --git a/django/forms/formsets.py b/django/forms/formsets.py index 57676428ff..b73d1d742e 100644 a b class BaseFormSet(RenderableFormMixin): 257257 258258 @property 259259 def empty_form(self): 260 form = ... | 2022-09-09T10:07:29Z | 4.2 | ["test_empty_permitted_ignored_empty_form (forms_tests.tests.test_formsets.FormsFormsetTestCase)", "test_empty_permitted_ignored_empty_form (forms_tests.tests.test_formsets.Jinja2FormsFormsetTestCase)"] | ["all_valid() validates all forms, even when some are invalid.", "test_valid (forms_tests.tests.test_formsets.AllValidTests)", "is_multipart() works with an empty formset.", "An empty formset still calls clean()", "Media is available on empty formset.", "Management forms are already rendered with the new div template."... | 0fbdb9784da915fce5dcc1fe82bac9b4785749e5 |
django__django-13033 | Difficult to identify but can get an idea with sql statements and by considering file formats | null | django/db/models/sql/compiler.py | django/django | a59de6e89e8dc1f3e71c9a5a5bbceb373ea5247e | diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -727,7 +727,12 @@ def find_ordering_name(self, name, opts, alias=None, default_order='ASC',
# If we get to this point and the field is a relation to ... | diff --git a/tests/ordering/models.py b/tests/ordering/models.py
--- a/tests/ordering/models.py
+++ b/tests/ordering/models.py
@@ -18,6 +18,7 @@
class Author(models.Model):
name = models.CharField(max_length=63, null=True, blank=True)
+ editor = models.ForeignKey('self', models.CASCADE, null=True)
cla... | Self referencing foreign key doesn't correctly order by a relation "_id" field.
Description
Initially discovered on 2.2.10 but verified still happens on 3.0.6. Given the following models:
class OneModel(models.Model):
class Meta:
ordering = ("-id",)
id = models.BigAutoField(primary_key=True)
root = models.Foreig... | This is with a postgres backend. Fairly vanilla Django. Some generic middleware installed (cors, csrf, auth, session). Apps are: INSTALLED_APPS = ( "django.contrib.contenttypes", "django.contrib.auth", "django.contrib.admin", "django.contrib.sessions", "django.contrib.messages", "django.contrib.staticfiles", "corsheade... | 2020-06-07T14:52:19Z | 3.2 | ["test_order_by_self_referential_fk (ordering.tests.OrderingTests)"] | ["test_default_ordering (ordering.tests.OrderingTests)", "F expressions can be used in Meta.ordering.", "test_default_ordering_override (ordering.tests.OrderingTests)", "test_extra_ordering (ordering.tests.OrderingTests)", "test_extra_ordering_quoting (ordering.tests.OrderingTests)", "test_extra_ordering_with_table_nam... | 65dfb06a1ab56c238cc80f5e1c31f61210c4577d |
django__django-14411 | need to identify ReadOnlyPasswordHashWidget | 0 | django/contrib/auth/forms.py | django/django | fa4e963ee7e6876581b5432363603571839ba00c | diff --git a/django/contrib/auth/forms.py b/django/contrib/auth/forms.py
--- a/django/contrib/auth/forms.py
+++ b/django/contrib/auth/forms.py
@@ -50,6 +50,9 @@ def get_context(self, name, value, attrs):
context['summary'] = summary
return context
+ def id_for_label(self, id_):
+ return No... | diff --git a/tests/auth_tests/test_forms.py b/tests/auth_tests/test_forms.py
--- a/tests/auth_tests/test_forms.py
+++ b/tests/auth_tests/test_forms.py
@@ -13,6 +13,7 @@
from django.core import mail
from django.core.exceptions import ValidationError
from django.core.mail import EmailMultiAlternatives
+from django.for... | Label for ReadOnlyPasswordHashWidget points to non-labelable element.
Description
(last modified by David Sanders)
In the admin, the label element for the ReadOnlyPasswordHashWidget widget has a 'for' attribute which points to a non-labelable element, since the widget just renders text, not an input. There's no... | 2021-05-19T04:05:47Z | 4.0 | ["ReadOnlyPasswordHashWidget doesn't contain a for attribute in the"] | ["test_html_autocomplete_attributes (auth_tests.test_forms.AdminPasswordChangeFormTest)", "test_missing_passwords (auth_tests.test_forms.AdminPasswordChangeFormTest)", "test_non_matching_passwords (auth_tests.test_forms.AdminPasswordChangeFormTest)", "test_one_password (auth_tests.test_forms.AdminPasswordChangeFormTest... | 475cffd1d64c690cdad16ede4d5e81985738ceb4 | |
django__django-13447 | need to identify function _buil_app_dict. it is quite possible | 0 | django/contrib/admin/sites.py | django/django | 0456d3e42795481a186db05719300691fe2a1029 | diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py
--- a/django/contrib/admin/sites.py
+++ b/django/contrib/admin/sites.py
@@ -461,6 +461,7 @@ def _build_app_dict(self, request, label=None):
info = (app_label, model._meta.model_name)
model_dict = {
+ 'm... | diff --git a/tests/admin_views/test_adminsite.py b/tests/admin_views/test_adminsite.py
--- a/tests/admin_views/test_adminsite.py
+++ b/tests/admin_views/test_adminsite.py
@@ -55,7 +55,9 @@ def test_available_apps(self):
admin_views = apps[0]
self.assertEqual(admin_views['app_label'], 'admin_views')
... | Added model class to app_list context
Description
(last modified by Raffaele Salmaso)
I need to manipulate the app_list in my custom admin view, and the easiest way to get the result is to have access to the model class (currently the dictionary is a serialized model).
In addition I would make the _build_app_di... | 2020-09-22T08:49:25Z | 4.0 | ["test_available_apps (admin_views.test_adminsite.SiteEachContextTest)"] | ["test_add_action (admin_views.test_adminsite.SiteActionsTests)", "test_disable_action (admin_views.test_adminsite.SiteActionsTests)", "AdminSite.get_action() returns an action even if it's disabled.", "test_each_context (admin_views.test_adminsite.SiteEachContextTest)", "test_each_context_site_url_with_script_name (ad... | 475cffd1d64c690cdad16ede4d5e81985738ceb4 | |
django__django-12856 | check constraint and unique constraints are quite similar and it has given in the description implicitly otherwise difficult to find it | null | django/db/models/base.py | django/django | 8328811f048fed0dd22573224def8c65410c9f2e | diff --git a/django/db/models/base.py b/django/db/models/base.py
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -1926,6 +1926,12 @@ def _check_constraints(cls, databases):
id='models.W038',
)
)
+ fields = (
+ fiel... | diff --git a/tests/invalid_models_tests/test_models.py b/tests/invalid_models_tests/test_models.py
--- a/tests/invalid_models_tests/test_models.py
+++ b/tests/invalid_models_tests/test_models.py
@@ -1501,3 +1501,70 @@ class Meta:
]
self.assertEqual(Model.check(databases=self.databases), [])
... | Add check for fields of UniqueConstraints.
Description
(last modified by Marnanel Thurman)
When a model gains a UniqueConstraint, makemigrations doesn't check that the fields named therein actually exist.
This is in contrast to the older unique_together syntax, which raises models.E012 if the fields don't exist... | Demonstration
Agreed. We can simply call cls._check_local_fields() for UniqueConstraint's fields. I attached tests.
Tests.
Hello Django Team, My name is Jannah Mandwee, and I am working on my final project for my undergraduate software engineering class (here is the link to the assignment: https://web.eecs.umich.edu/~... | 2020-05-04T21:29:23Z | 3.2 | ["test_unique_constraint_pointing_to_m2m_field (invalid_models_tests.test_models.ConstraintsTests)", "test_unique_constraint_pointing_to_missing_field (invalid_models_tests.test_models.ConstraintsTests)", "test_unique_constraint_pointing_to_non_local_field (invalid_models_tests.test_models.ConstraintsTests)"] | ["test_check_jsonfield (invalid_models_tests.test_models.JSONFieldTests)", "test_check_jsonfield_required_db_features (invalid_models_tests.test_models.JSONFieldTests)", "test_ordering_pointing_to_json_field_value (invalid_models_tests.test_models.JSONFieldTests)", "test_db_column_clash (invalid_models_tests.test_model... | 65dfb06a1ab56c238cc80f5e1c31f61210c4577d |
django__django-14787 | file structure is important | null | django/utils/decorators.py | django/django | 004b4620f6f4ad87261e149898940f2dcd5757ef | diff --git a/django/utils/decorators.py b/django/utils/decorators.py
--- a/django/utils/decorators.py
+++ b/django/utils/decorators.py
@@ -37,7 +37,7 @@ def _wrapper(self, *args, **kwargs):
# 'self' argument, but it's a closure over self so it can call
# 'func'. Also, wrap method.__get__() in a functi... | diff --git a/tests/decorators/tests.py b/tests/decorators/tests.py
--- a/tests/decorators/tests.py
+++ b/tests/decorators/tests.py
@@ -425,6 +425,29 @@ class Test:
def __module__(cls):
return "tests"
+ def test_wrapper_assignments(self):
+ """@method_decorator preserves... | method_decorator() should preserve wrapper assignments
Description
the function that is passed to the decorator is a partial object and does not have any of the attributes expected from a function i.e. __name__, __module__ etc...
consider the following case
def logger(func):
@wraps(func)
def inner(*args, **kwargs):... | 2021-08-23T12:59:59Z | 4.1 | ["@method_decorator preserves wrapper assignments."] | ["test_cache_control_decorator_http_request (decorators.tests.CacheControlDecoratorTest)", "Ensures @xframe_options_deny properly sets the X-Frame-Options header.", "Ensures @xframe_options_exempt properly instructs the", "Ensures @xframe_options_sameorigin properly sets the X-Frame-Options", "Built-in decorators set c... | 647480166bfe7532e8c471fef0146e3a17e6c0c9 | |
django__django-11815 | need of a trie data structure? | null | django/db/migrations/serializer.py | django/django | e02f67ef2d03d48128e7a118bf75f0418e24e8ac | diff --git a/django/db/migrations/serializer.py b/django/db/migrations/serializer.py
--- a/django/db/migrations/serializer.py
+++ b/django/db/migrations/serializer.py
@@ -120,9 +120,10 @@ class EnumSerializer(BaseSerializer):
def serialize(self):
enum_class = self.value.__class__
module = enum_cl... | diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py
--- a/tests/migrations/test_writer.py
+++ b/tests/migrations/test_writer.py
@@ -257,6 +257,10 @@ class TextEnum(enum.Enum):
A = 'a-value'
B = 'value-b'
+ class TextTranslatedEnum(enum.Enum):
+ A ... | Migrations uses value of enum object instead of its name.
Description
(last modified by oasl)
When using Enum object as a default value for a CharField, the generated migration file uses the value of the Enum object instead of the its name. This causes a problem when using Django translation on the value of the... | Thanks for this report, however I'm not sure how translated values can brake migrations. Can you provide a sample project to reproduce this issue? Migrations with translatable strings works fine for me: >>> class TextEnum(enum.Enum): ... C = _('translatable value') ... >>> TextEnum(_('translatable value')) <TextEnum.C:... | 2019-09-24T21:45:36Z | 3.1 | ["test_serialize_class_based_validators (migrations.test_writer.WriterTests)", "test_serialize_enums (migrations.test_writer.WriterTests)"] | ["test_args_kwargs_signature (migrations.test_writer.OperationWriterTests)", "test_args_signature (migrations.test_writer.OperationWriterTests)", "test_empty_signature (migrations.test_writer.OperationWriterTests)", "test_expand_args_signature (migrations.test_writer.OperationWriterTests)", "test_kwargs_signature (migr... | 0668164b4ac93a5be79f5b87fae83c657124d9ab |
django__django-16595 | file structure | null | django/db/migrations/operations/fields.py | django/django | f9fe062de5fc0896d6bbbf3f260b5c44473b3c77 | diff --git a/django/db/migrations/operations/fields.py b/django/db/migrations/operations/fields.py
--- a/django/db/migrations/operations/fields.py
+++ b/django/db/migrations/operations/fields.py
@@ -247,9 +247,9 @@ def migration_name_fragment(self):
return "alter_%s_%s" % (self.model_name_lower, self.name_lowe... | diff --git a/tests/migrations/test_optimizer.py b/tests/migrations/test_optimizer.py
--- a/tests/migrations/test_optimizer.py
+++ b/tests/migrations/test_optimizer.py
@@ -221,10 +221,10 @@ def test_create_alter_owrt_delete_model(self):
migrations.AlterOrderWithRespectTo("Foo", "a")
)
- def _t... | Migration optimizer does not reduce multiple AlterField
Description
Let's consider the following operations:
operations = [
migrations.AddField(
model_name="book",
name="title",
field=models.CharField(max_length=256, null=True),
),
migrations.AlterField(
model_name="book",
name="title",
field=models.C... | Your analysis is correct Laurent, the reduction of multiple AlterField against the same model is simply not implemented today hence why you're running into this behaviour. Given you're already half way there I would encourage you to submit a PR that adds these changes and an optimizer regression test to cover them if... | 2023-02-24T10:30:35Z | 5.0 | ["test_alter_alter_field (migrations.test_optimizer.OptimizerTests.test_alter_alter_field)"] | ["AlterField should optimize into AddField.", "RemoveField should cancel AddField", "RenameField should optimize into AddField", "test_alter_alter_index_model (migrations.test_optimizer.OptimizerTests.test_alter_alter_index_model)", "test_alter_alter_owrt_model (migrations.test_optimizer.OptimizerTests.test_alter_alter... | 4a72da71001f154ea60906a2f74898d32b7322a7 |
django__django-15388 | taking alwaysgraph just based on file name can be misleading therefore need to confirm its full path HARD TO JUDGE BUT CAM GET IDEA USING FILE STRUCTURE TEMPLATE | null | django/template/autoreload.py | django/django | c5cd8783825b5f6384417dac5f3889b4210b7d08 | diff --git a/django/template/autoreload.py b/django/template/autoreload.py
--- a/django/template/autoreload.py
+++ b/django/template/autoreload.py
@@ -48,6 +48,8 @@ def watch_for_template_changes(sender, **kwargs):
@receiver(file_changed, dispatch_uid='template_loaders_file_changed')
def template_changed(sender, fi... | diff --git a/tests/template_tests/test_autoreloader.py b/tests/template_tests/test_autoreloader.py
--- a/tests/template_tests/test_autoreloader.py
+++ b/tests/template_tests/test_autoreloader.py
@@ -39,6 +39,19 @@ def test_non_template_changed(self, mock_reset):
self.assertIsNone(autoreload.template_changed(No... | Dev Server fails to restart after adding BASE_DIR to TEMPLATES[0]['DIRS'] in settings
Description
Repro steps:
$ pip install -U django
$ django-admin startproject <name>
Open settings.py, copy the BASE_DIR variable from line 16 and paste it into the empty DIRS list on line 57
$ ./manage.py runserver
Back in your IDE,... | I don't think this is a bug, really. Adding BASE_DIR to the list of template directories causes the entire project directory to be marked as a template directory, and Django does not watch for changes in template directories by design.
I think I encountered this recently while making examples for #33461, though I didn'... | 2022-02-02T17:09:51Z | 4.1 | ["test_non_template_changed_in_template_directory (template_tests.test_autoreloader.TemplateReloadTests)"] | ["test_get_template_directories (template_tests.test_autoreloader.Jinja2TemplateReloadTests)", "test_reset_all_loaders (template_tests.test_autoreloader.Jinja2TemplateReloadTests)", "test_watch_for_template_changes (template_tests.test_autoreloader.Jinja2TemplateReloadTests)", "test_get_template_directories (template_t... | 647480166bfe7532e8c471fef0146e3a17e6c0c9 |
django__django-11905 | only possibility with isnull but it has not followed exact capital sinple format in issue description | null | django/db/models/lookups.py | django/django | 2f72480fbd27896c986c45193e1603e35c0b19a7 | diff --git a/django/db/models/lookups.py b/django/db/models/lookups.py
--- a/django/db/models/lookups.py
+++ b/django/db/models/lookups.py
@@ -1,5 +1,6 @@
import itertools
import math
+import warnings
from copy import copy
from django.core.exceptions import EmptyResultSet
@@ -9,6 +10,7 @@
)
from django.db.model... | diff --git a/tests/lookup/models.py b/tests/lookup/models.py
--- a/tests/lookup/models.py
+++ b/tests/lookup/models.py
@@ -96,3 +96,15 @@ class Product(models.Model):
class Stock(models.Model):
product = models.ForeignKey(Product, models.CASCADE)
qty_available = models.DecimalField(max_digits=6, decimal_plac... | Prevent using __isnull lookup with non-boolean value.
Description
(last modified by Mariusz Felisiak)
__isnull should not allow for non-boolean values. Using truthy/falsey doesn't promote INNER JOIN to an OUTER JOIN but works fine for a simple queries. Using non-boolean values is undocumented and untested. IMO... | PR here: https://github.com/django/django/pull/11873
After the reconsideration I don't think that we should change this documented behavior (that is in Django from the very beginning). __isnull lookup expects boolean values in many places and IMO it would be confusing if we'll allow for truthy/falsy values, e.g. take... | 2019-10-11T18:19:39Z | 3.1 | ["test_isnull_non_boolean_value (lookup.tests.LookupTests)", "test_iterator (lookup.tests.LookupTests)"] | ["test_chain_date_time_lookups (lookup.tests.LookupTests)", "test_count (lookup.tests.LookupTests)", "test_custom_field_none_rhs (lookup.tests.LookupTests)", "Lookup.can_use_none_as_rhs=True allows None as a lookup value.", "test_error_messages (lookup.tests.LookupTests)", "test_escaping (lookup.tests.LookupTests)", "t... | 0668164b4ac93a5be79f5b87fae83c657124d9ab |
django__django-15320 | Easy Just need to identift SUbquery class as the main issue | 0 | django/db/models/expressions.py | django/django | b55ebe32417e0884b6b8b3e1bc0379033aa221af | diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py
--- a/django/db/models/expressions.py
+++ b/django/db/models/expressions.py
@@ -1149,7 +1149,8 @@ class Subquery(BaseExpression, Combinable):
def __init__(self, queryset, output_field=None, **extra):
# Allow the usage of both... | diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py
--- a/tests/expressions/tests.py
+++ b/tests/expressions/tests.py
@@ -537,6 +537,15 @@ def test_subquery_eq(self):
qs.query.annotations['small_company'],
)
+ def test_subquery_sql(self):
+ employees = Employee.objects... | Subquery.as_sql() generates invalid SQL.
Description
(last modified by M1ha Shvn)
Since this commit Subquery.as_sql(...) method returns incorrect SQL removing first and last symbols instead of absent breakets. Adding Subquery().query.subquery = True attribute fixes the problem. From my point of view, it should... | Sounds reasonable.
Sounds reasonable to me as well, I'd only suggest we .clone() the query before altering though. | 2022-01-14T23:43:34Z | 4.1 | ["test_subquery_sql (expressions.tests.BasicExpressionsTests)"] | ["test_deconstruct (expressions.tests.FTests)", "test_deepcopy (expressions.tests.FTests)", "test_equal (expressions.tests.FTests)", "test_hash (expressions.tests.FTests)", "test_not_equal_Value (expressions.tests.FTests)", "test_and (expressions.tests.CombinableTests)", "test_negation (expressions.tests.CombinableTest... | 647480166bfe7532e8c471fef0146e3a17e6c0c9 |
django__django-13230 | need to identify root cause as syndication.views | null | django/contrib/syndication/views.py | django/django | 184a6eebb0ef56d5f1b1315a8e666830e37f3f81 | diff --git a/django/contrib/syndication/views.py b/django/contrib/syndication/views.py
--- a/django/contrib/syndication/views.py
+++ b/django/contrib/syndication/views.py
@@ -212,6 +212,7 @@ def get_feed(self, obj, request):
author_name=author_name,
author_email=author_email,
... | diff --git a/tests/syndication_tests/feeds.py b/tests/syndication_tests/feeds.py
--- a/tests/syndication_tests/feeds.py
+++ b/tests/syndication_tests/feeds.py
@@ -29,6 +29,9 @@ def item_pubdate(self, item):
def item_updateddate(self, item):
return item.updated
+ def item_comments(self, item):
+ ... | Add support for item_comments to syndication framework
Description
Add comments argument to feed.add_item() in syndication.views so that item_comments can be defined directly without having to take the detour via item_extra_kwargs .
Additionally, comments is already explicitly mentioned in the feedparser, but not imp... | 2020-07-23T14:59:50Z | 3.2 | ["test_rss2_feed (syndication_tests.tests.SyndicationFeedTest)"] | ["test_add_domain (syndication_tests.tests.SyndicationFeedTest)", "test_atom_feed (syndication_tests.tests.SyndicationFeedTest)", "test_atom_feed_published_and_updated_elements (syndication_tests.tests.SyndicationFeedTest)", "test_atom_multiple_enclosures (syndication_tests.tests.SyndicationFeedTest)", "test_atom_singl... | 65dfb06a1ab56c238cc80f5e1c31f61210c4577d | |
django__django-11179 | root cause file | null | django/db/models/deletion.py | django/django | 19fc6376ce67d01ca37a91ef2f55ef769f50513a | diff --git a/django/db/models/deletion.py b/django/db/models/deletion.py
--- a/django/db/models/deletion.py
+++ b/django/db/models/deletion.py
@@ -277,6 +277,7 @@ def delete(self):
if self.can_fast_delete(instance):
with transaction.mark_for_rollback_on_error():
count ... | diff --git a/tests/delete/tests.py b/tests/delete/tests.py
--- a/tests/delete/tests.py
+++ b/tests/delete/tests.py
@@ -1,6 +1,7 @@
from math import ceil
from django.db import IntegrityError, connection, models
+from django.db.models.deletion import Collector
from django.db.models.sql.constants import GET_ITERATOR_... | delete() on instances of models without any dependencies doesn't clear PKs.
Description
Deleting any model with no dependencies not updates the PK on the model. It should be set to None after .delete() call.
See Django.db.models.deletion:276-281. Should update the model line 280.
| Reproduced at 1ffddfc233e2d5139cc6ec31a4ec6ef70b10f87f. Regression in bc7dd8490b882b2cefdc7faf431dc64c532b79c9. Thanks for the report.
Regression test.
I have attached a simple fix which mimics what https://github.com/django/django/blob/master/django/db/models/deletion.py#L324-L326 does for multiple objects. I am not ... | 2019-04-05T15:54:39Z | 3.0 | ["test_fast_delete_instance_set_pk_none (delete.tests.FastDeleteTests)"] | ["test_fast_delete_empty_no_update_can_self_select (delete.tests.FastDeleteTests)", "test_fast_delete_fk (delete.tests.FastDeleteTests)", "test_fast_delete_inheritance (delete.tests.FastDeleteTests)", "test_fast_delete_joined_qs (delete.tests.FastDeleteTests)", "test_fast_delete_large_batch (delete.tests.FastDeleteTest... | 419a78300f7cd27611196e1e464d50fd0385ff27 |
django__django-15781 | cant understand even for a human | null | django/core/management/base.py | django/django | 8d160f154f0240a423e83ffe0690e472f837373c | diff --git a/django/core/management/base.py b/django/core/management/base.py
--- a/django/core/management/base.py
+++ b/django/core/management/base.py
@@ -286,10 +286,10 @@ def create_parser(self, prog_name, subcommand, **kwargs):
Create and return the ``ArgumentParser`` which will be used to
parse th... | diff --git a/tests/user_commands/tests.py b/tests/user_commands/tests.py
--- a/tests/user_commands/tests.py
+++ b/tests/user_commands/tests.py
@@ -1,4 +1,5 @@
import os
+from argparse import ArgumentDefaultsHelpFormatter
from io import StringIO
from unittest import mock
@@ -408,8 +409,14 @@ def test_subparser_inva... | Customizable management command formatters.
Description
With code like:
class Command(BaseCommand):
help = '''
Import a contract from tzkt.
Example usage:
./manage.py tzkt_import 'Tezos Mainnet' KT1HTDtMBRCKoNHjfWEEvXneGQpCfPAt6BRe
'''
Help output is:
$ ./manage.py help tzkt_import
usage: manage.py tzkt_import ... | This seems no fault of Django but is rather the default behavior of ArgumentParser ("By default, ArgumentParser objects line-wrap the description and epilog texts in command-line help messages"). This can be changed by using a custom formatter_class, though Django already specifies a custom one (DjangoHelpFormatter)... | 2022-06-18T19:39:34Z | 4.2 | ["BaseCommand.create_parser() passes kwargs to CommandParser."] | ["test_get_random_secret_key (user_commands.tests.UtilsTests)", "test_is_ignored_path_false (user_commands.tests.UtilsTests)", "test_is_ignored_path_true (user_commands.tests.UtilsTests)", "test_no_existent_external_program (user_commands.tests.UtilsTests)", "test_normalize_path_patterns_truncates_wildcard_base (user_c... | 0fbdb9784da915fce5dcc1fe82bac9b4785749e5 |
django__django-16408 | stack trace with tests file hard becuase, situation where backward arrows are needed | backward 1 | django/db/models/sql/compiler.py | django/django | ef85b6bf0bc5a8b194f0724cf5bbedbcee402b96 | diff --git a/django/db/models/sql/compiler.py b/django/db/models/sql/compiler.py
--- a/django/db/models/sql/compiler.py
+++ b/django/db/models/sql/compiler.py
@@ -1274,6 +1274,9 @@ def local_setter(final_field, obj, from_obj):
if from_obj:
final_field.remote_field.set_cached_value(... | diff --git a/tests/known_related_objects/tests.py b/tests/known_related_objects/tests.py
--- a/tests/known_related_objects/tests.py
+++ b/tests/known_related_objects/tests.py
@@ -164,3 +164,23 @@ def test_reverse_fk_select_related_multiple(self):
)
self.assertIs(ps[0], ps[0].pool_1.poolstyle)
... | Multi-level FilteredRelation with select_related() may set wrong related object.
Description
test case:
# add to known_related_objects.tests.ExistingRelatedInstancesTests
def test_wrong_select_related(self):
with self.assertNumQueries(3):
p = list(PoolStyle.objects.annotate(
tournament_pool=FilteredRelation... | Seems this bug can be fixed by: M django/db/models/sql/compiler.py @@ -1270,6 +1270,9 @@ class SQLCompiler: if from_obj: final_field.remote_field.set_cached_value(from_obj, obj) + def no_local_setter(obj, from_obj): + pass + def remote_setter(name, obj, from_obj): setattr(from_obj, name, obj) @@ -1291,7 +1294,7 @@ clas... | 2022-12-29T02:08:29Z | 5.0 | ["test_multilevel_reverse_fk_cyclic_select_related (known_related_objects.tests.ExistingRelatedInstancesTests.test_multilevel_reverse_fk_cyclic_select_related)", "test_multilevel_reverse_fk_select_related (known_related_objects.tests.ExistingRelatedInstancesTests.test_multilevel_reverse_fk_select_related)"] | ["test_foreign_key (known_related_objects.tests.ExistingRelatedInstancesTests.test_foreign_key)", "test_foreign_key_multiple_prefetch (known_related_objects.tests.ExistingRelatedInstancesTests.test_foreign_key_multiple_prefetch)", "test_foreign_key_prefetch_related (known_related_objects.tests.ExistingRelatedInstancesT... | 4a72da71001f154ea60906a2f74898d32b7322a7 |
django__django-13710 | file structure name search need ti handle large code files as well | null | django/contrib/admin/options.py | django/django | 1bd6a7a0acc11e249fca11c017505ad39f15ebf6 | diff --git a/django/contrib/admin/options.py b/django/contrib/admin/options.py
--- a/django/contrib/admin/options.py
+++ b/django/contrib/admin/options.py
@@ -2037,10 +2037,13 @@ def __init__(self, parent_model, admin_site):
self.opts = self.model._meta
self.has_registered_model = admin_site.is_regist... | diff --git a/tests/admin_inlines/tests.py b/tests/admin_inlines/tests.py
--- a/tests/admin_inlines/tests.py
+++ b/tests/admin_inlines/tests.py
@@ -967,6 +967,55 @@ def test_extra_inlines_are_not_shown(self):
class TestVerboseNameInlineForms(TestDataMixin, TestCase):
factory = RequestFactory()
+ def test_verb... | Use Admin Inline verbose_name as default for Inline verbose_name_plural
Description
Django allows specification of a verbose_name and a verbose_name_plural for Inline classes in admin views. However, verbose_name_plural for an Inline is not currently based on a specified verbose_name. Instead, it continues to be base... | Please push your patch as a Django pull request. | 2020-11-23T04:39:05Z | 4.0 | ["test_verbose_name_inline (admin_inlines.tests.TestVerboseNameInlineForms)"] | ["Regression for #9362", "test_deleting_inline_with_protected_delete_does_not_validate (admin_inlines.tests.TestInlineProtectedOnDelete)", "test_all_inline_media (admin_inlines.tests.TestInlineMedia)", "test_inline_media_only_base (admin_inlines.tests.TestInlineMedia)", "test_inline_media_only_inline (admin_inlines.tes... | 475cffd1d64c690cdad16ede4d5e81985738ceb4 |
django__django-10924 | need to identify issue is wirh FilePathField and level iszero | null | django/db/models/fields/__init__.py | django/django | bceadd2788dc2dad53eba0caae172bd8522fd483 | diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -1709,7 +1709,7 @@ def get_prep_value(self, value):
def formfield(self, **kwargs):
return super().formfield(**{
- 'path... | diff --git a/tests/model_fields/test_filepathfield.py b/tests/model_fields/test_filepathfield.py
new file mode 100644
--- /dev/null
+++ b/tests/model_fields/test_filepathfield.py
@@ -0,0 +1,22 @@
+import os
+
+from django.db.models import FilePathField
+from django.test import SimpleTestCase
+
+
+class FilePathFieldTes... | Allow FilePathField path to accept a callable.
Description
I have a special case where I want to create a model containing the path to some local files on the server/dev machine. Seeing as the place where these files are stored is different on different machines I have the following:
import os
from django.conf import... | So, to clarify, what exactly is the bug/feature proposal/issue here? The way I see it, you're supposed to use os.path.join() and LOCAL_FILE_DIR to define a relative path. It's sort of like how we use BASE_DIR to define relative paths in a lot of other places. Could you please clarify a bit more as to what the issue is ... | 2019-02-03T11:30:12Z | 3.0 | ["test_callable_path (model_fields.test_filepathfield.FilePathFieldTests)"] | ["test_path (model_fields.test_filepathfield.FilePathFieldTests)"] | 419a78300f7cd27611196e1e464d50fd0385ff27 |
django__django-13315 | need a trie | null | django/forms/models.py | django/django | 36bc47069ce071e80c8129500de3b8664d2058a7 | diff --git a/django/forms/models.py b/django/forms/models.py
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -97,10 +97,18 @@ def model_to_dict(instance, fields=None, exclude=None):
def apply_limit_choices_to_to_formfield(formfield):
"""Apply limit_choices_to to the formfield's queryset if needed."... | diff --git a/tests/model_forms/models.py b/tests/model_forms/models.py
--- a/tests/model_forms/models.py
+++ b/tests/model_forms/models.py
@@ -411,9 +411,14 @@ class StumpJoke(models.Model):
Character,
models.CASCADE,
limit_choices_to=today_callable_dict,
- related_name="+",
+ r... | limit_choices_to on a ForeignKey can render duplicate options in formfield
Description
If you pass a Q object as limit_choices_to on a ForeignKey field involving a join, you may end up with duplicate options in your form.
See regressiontest in patch for a clear view on the problem.
| Replying to SmileyChris: I've updated the patch to resolve the conflicts I've had since you flagged this one as "Ready for checkin". No real change.
update resolving conflict
Is there something I can do to get this checked in? I re-read the Triage docs. As far as I can see "A developer checks in the fix" is the only s... | 2020-08-17T04:24:39Z | 3.2 | ["test_limit_choices_to_no_duplicates (model_forms.tests.LimitChoicesToTests)"] | ["test_modelform_factory_metaclass (model_forms.tests.CustomMetaclassTestCase)", "test_bad_callback (model_forms.tests.FormFieldCallbackTests)", "Regression for #13095: Using base forms with widgets defined in Meta should not raise errors.", "A custom formfield_callback is used if provided", "Regression for #15315: mod... | 65dfb06a1ab56c238cc80f5e1c31f61210c4577d |
django__django-13925 | variable is only option DEFAULT_AUTO_FIELD | null | django/db/models/base.py | django/django | 0c42cdf0d2422f4c080e93594d5d15381d6e955e | diff --git a/django/db/models/base.py b/django/db/models/base.py
--- a/django/db/models/base.py
+++ b/django/db/models/base.py
@@ -1299,6 +1299,11 @@ def check(cls, **kwargs):
def _check_default_pk(cls):
if (
cls._meta.pk.auto_created and
+ # Inherited PKs are checked in parents mo... | diff --git a/tests/check_framework/test_model_checks.py b/tests/check_framework/test_model_checks.py
--- a/tests/check_framework/test_model_checks.py
+++ b/tests/check_framework/test_model_checks.py
@@ -376,23 +376,62 @@ def mocked_is_overridden(self, setting):
@isolate_apps('check_framework.apps.CheckDefaultPKConfig'... | models.W042 is raised on inherited manually specified primary key.
Description
I have models which inherit from other models, and they should inherit the primary key. This works fine with Django 3.1. However, if I install Django 3.2 alpha, when I run make_migrations I get the following error messages:
System check id... | Hello Uri, thanks for testing out the alpha and the report. These models should not use auto-created primary keys! I already defined the primary key in the ancestor of the model. For example class Entity which class User inherits from. It looks to me like a bug in Django 3.2 alpha. Could you provide a minimal project w... | 2021-01-21T08:08:55Z | 4.0 | ["test_auto_created_inherited_pk (check_framework.test_model_checks.ModelDefaultAutoFieldTests)", "test_explicit_inherited_pk (check_framework.test_model_checks.ModelDefaultAutoFieldTests)"] | ["test_app_default_auto_field (check_framework.test_model_checks.ModelDefaultAutoFieldTests)", "test_auto_created_inherited_parent_link (check_framework.test_model_checks.ModelDefaultAutoFieldTests)", "test_auto_created_pk (check_framework.test_model_checks.ModelDefaultAutoFieldTests)", "test_default_auto_field_setting... | 475cffd1d64c690cdad16ede4d5e81985738ceb4 |
django__django-16820 | null | null | django/db/migrations/operations/models.py | django/django | c61219a7ae051d2baab53f041e00592011fc550c | diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
--- a/django/db/migrations/operations/models.py
+++ b/django/db/migrations/operations/models.py
@@ -303,6 +303,71 @@ def reduce(self, operation, app_label):
managers=self.managers,
... | diff --git a/tests/migrations/test_autodetector.py b/tests/migrations/test_autodetector.py
--- a/tests/migrations/test_autodetector.py
+++ b/tests/migrations/test_autodetector.py
@@ -2266,10 +2266,9 @@ def test_same_app_circular_fk_dependency_with_unique_together_and_indexes(self):
changes,
"e... | Squashing migrations with Meta.index_together -> indexes transition should remove deprecation warnings.
Description
Squashing migrations with Meta.index_together -> Meta.indexes transition should remove deprecation warnings. As far as I'm aware, it's a 4.2 release blocker because you cannot get rid of the index_toget... | 2023-05-02T06:32:13Z | 5.0 | ["test_create_model_add_index (migrations.test_optimizer.OptimizerTests.test_create_model_add_index)", "test_create_model_index_together_rename_index (migrations.test_optimizer.OptimizerTests.test_create_model_index_together_rename_index)", "test_create_model_remove_index (migrations.test_optimizer.OptimizerTests.test_... | ["test_auto (migrations.test_autodetector.MigrationSuggestNameTests.test_auto)", "test_many_operations_suffix (migrations.test_autodetector.MigrationSuggestNameTests.test_many_operations_suffix)", "test_no_operations (migrations.test_autodetector.MigrationSuggestNameTests.test_no_operations)", "test_no_operations_initi... | 4a72da71001f154ea60906a2f74898d32b7322a7 | |
django__django-12708 | can identify rooot cause | null | django/db/backends/base/schema.py | django/django | 447980e72ac01da1594dd3373a03ba40b7ee6f80 | diff --git a/django/db/backends/base/schema.py b/django/db/backends/base/schema.py
--- a/django/db/backends/base/schema.py
+++ b/django/db/backends/base/schema.py
@@ -393,7 +393,12 @@ def alter_index_together(self, model, old_index_together, new_index_together):
news = {tuple(fields) for fields in new_index_to... | diff --git a/tests/migrations/test_base.py b/tests/migrations/test_base.py
--- a/tests/migrations/test_base.py
+++ b/tests/migrations/test_base.py
@@ -62,7 +62,11 @@ def assertIndexExists(self, table, columns, value=True, using='default', index_t
any(
c["index"]
... | Migration crashes deleting an index_together if there is a unique_together on the same fields
Description
Happens with Django 1.11.10
Steps to reproduce:
1) Create models with 2 fields, add 2 same fields to unique_together and to index_together
2) Delete index_together -> Fail
It will fail at django/db/backends/base/... | Reproduced on master at 623139b5d1bd006eac78b375bcaf5948e695c3c6.
I haven't looked under the hood on this yet, but could it be related to the ordering of the operations generated for the mgiration? on first inspection it feels like this and #28862 could be caused by the same/similar underlying problem in how FieldRelat... | 2020-04-12T22:20:59Z | 3.1 | ["test_alter_index_together_remove_with_unique_together (migrations.test_operations.OperationTests)"] | ["test_references_model_mixin (migrations.test_operations.TestCreateModel)", "test_reference_field_by_through_fields (migrations.test_operations.FieldOperationTests)", "test_references_field_by_from_fields (migrations.test_operations.FieldOperationTests)", "test_references_field_by_name (migrations.test_operations.Fiel... | 0668164b4ac93a5be79f5b87fae83c657124d9ab |
django__django-14730 | need to identify ManyToManyField | level 0 | django/db/models/fields/related.py | django/django | 4fe3774c729f3fd5105b3001fe69a70bdca95ac3 | diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
@@ -1258,6 +1258,16 @@ def _check_ignored_options(self, **kwargs):
)
)
+ if self.remote_field.symmetrical and self... | diff --git a/tests/field_deconstruction/tests.py b/tests/field_deconstruction/tests.py
--- a/tests/field_deconstruction/tests.py
+++ b/tests/field_deconstruction/tests.py
@@ -438,7 +438,6 @@ class MyModel(models.Model):
m2m = models.ManyToManyField('self')
m2m_related_name = models.ManyToManyF... | Prevent developers from defining a related_name on symmetrical ManyToManyFields
Description
In ManyToManyField, if the symmetrical argument is passed, or if it's a self-referential ManyToMany relationship, the related field on the target model is not created. However, if a developer passes in the related_name not und... | I have a PR that implements this incoming.
https://github.com/django/django/pull/14730
OK, I guess we can do something here — it probably is a source of confusion. The same issue was raised in #18021 (but as an invalid bug report, rather than suggesting improving the messaging). Looking at the PR — I'm sceptical about... | 2021-08-03T04:27:52Z | 4.0 | ["test_many_to_many_with_useless_related_name (invalid_models_tests.test_relative_fields.RelativeFieldTests)"] | ["test_accessor_clash (invalid_models_tests.test_relative_fields.SelfReferentialFKClashTests)", "test_clash_under_explicit_related_name (invalid_models_tests.test_relative_fields.SelfReferentialFKClashTests)", "test_reverse_query_name_clash (invalid_models_tests.test_relative_fields.SelfReferentialFKClashTests)", "test... | 475cffd1d64c690cdad16ede4d5e81985738ceb4 |
django__django-13551 | easy after identifying _make_hash_value | level 0 | django/contrib/auth/tokens.py | django/django | 7f9e4524d6b23424cf44fbe1bf1f4e70f6bb066e | diff --git a/django/contrib/auth/tokens.py b/django/contrib/auth/tokens.py
--- a/django/contrib/auth/tokens.py
+++ b/django/contrib/auth/tokens.py
@@ -78,9 +78,9 @@ def _make_token_with_timestamp(self, user, timestamp, legacy=False):
def _make_hash_value(self, user, timestamp):
"""
- Hash the use... | diff --git a/tests/auth_tests/models/__init__.py b/tests/auth_tests/models/__init__.py
--- a/tests/auth_tests/models/__init__.py
+++ b/tests/auth_tests/models/__init__.py
@@ -8,6 +8,7 @@
from .no_password import NoPasswordUser
from .proxy import Proxy, UserProxy
from .uuid_pk import UUIDUser
+from .with_custom_email... | Changing user's email could invalidate password reset tokens
Description
Sequence:
Have account with email address foo@…
Password reset request for that email (unused)
foo@… account changes their email address
Password reset email is used
The password reset email's token should be rejected at that point, but in fact ... | 2020-10-17T17:22:01Z | 3.2 | ["Updating the user email address invalidates the token.", "test_token_with_different_secret (auth_tests.test_tokens.TokenGeneratorTest)"] | ["test_str (auth_tests.test_models.GroupTests)", "test_group_natural_key (auth_tests.test_models.NaturalKeysTestCase)", "test_user_natural_key (auth_tests.test_models.NaturalKeysTestCase)", "test_check_password (auth_tests.test_models.AnonymousUserTests)", "test_delete (auth_tests.test_models.AnonymousUserTests)", "tes... | 65dfb06a1ab56c238cc80f5e1c31f61210c4577d | |
django__django-14155 | easy after identifying ResolverMatch | level 0 | django/urls/resolvers.py b/django/urls/resolvers.py | django/django | 2f13c476abe4ba787b6cb71131818341911f43cc | diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py
--- a/django/urls/resolvers.py
+++ b/django/urls/resolvers.py
@@ -59,9 +59,16 @@ def __getitem__(self, index):
return (self.func, self.args, self.kwargs)[index]
def __repr__(self):
- return "ResolverMatch(func=%s, args=%s, kwargs=%s... | diff --git a/tests/urlpatterns_reverse/tests.py b/tests/urlpatterns_reverse/tests.py
--- a/tests/urlpatterns_reverse/tests.py
+++ b/tests/urlpatterns_reverse/tests.py
@@ -1141,10 +1141,30 @@ def test_repr(self):
self.assertEqual(
repr(resolve('/no_kwargs/42/37/')),
"ResolverMatch(func... | ResolverMatch.__repr__() doesn't handle functools.partial() nicely.
Description
(last modified by Nick Pope)
When a partial function is passed as the view, the __repr__ shows the func argument as functools.partial which isn't very helpful, especially as it doesn't reveal the underlying function or arguments pro... | 2021-03-19T15:44:25Z | 4.0 | ["test_repr (urlpatterns_reverse.tests.ResolverMatchTests)", "test_repr_functools_partial (urlpatterns_reverse.tests.ResolverMatchTests)", "test_resolver_match_on_request (urlpatterns_reverse.tests.ResolverMatchTests)"] | ["test_include_2_tuple (urlpatterns_reverse.tests.IncludeTests)", "test_include_2_tuple_namespace (urlpatterns_reverse.tests.IncludeTests)", "test_include_3_tuple (urlpatterns_reverse.tests.IncludeTests)", "test_include_3_tuple_namespace (urlpatterns_reverse.tests.IncludeTests)", "test_include_4_tuple (urlpatterns_reve... | 475cffd1d64c690cdad16ede4d5e81985738ceb4 | |
django__django-13933 | easy after identifying ModelMultipleChoiceField | level 0 | django/forms/models.py | django/django | 42e8cf47c7ee2db238bf91197ea398126c546741 | diff --git a/django/forms/models.py b/django/forms/models.py
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -1284,7 +1284,11 @@ def to_python(self, value):
value = getattr(value, key)
value = self.queryset.get(**{key: value})
except (ValueError, TypeError, self.query... | diff --git a/tests/forms_tests/tests/test_error_messages.py b/tests/forms_tests/tests/test_error_messages.py
--- a/tests/forms_tests/tests/test_error_messages.py
+++ b/tests/forms_tests/tests/test_error_messages.py
@@ -308,3 +308,16 @@ def test_modelchoicefield(self):
self.assertFormErrors(['REQUIRED'], f.clea... | ModelChoiceField does not provide value of invalid choice when raising ValidationError
Description
(last modified by Aaron Wiegel)
Compared with ChoiceField and others, ModelChoiceField does not show the value of the invalid choice when raising a validation error. Passing in parameters with the invalid value an... | This message has been the same literally forever b2b6fc8e3c78671c8b6af2709358c3213c84d119. Given that ChoiceField passes the value when raising the error, if you set error_messages you should be able to get the result you want.
Replying to Carlton Gibson: This message has been the same literally forever b2b6fc8e3c786... | 2021-01-26T03:58:23Z | 4.0 | ["test_modelchoicefield_value_placeholder (forms_tests.tests.test_error_messages.ModelChoiceFieldErrorMessagesTestCase)"] | ["test_modelchoicefield (forms_tests.tests.test_error_messages.ModelChoiceFieldErrorMessagesTestCase)", "test_booleanfield (forms_tests.tests.test_error_messages.FormsErrorMessagesTestCase)", "test_charfield (forms_tests.tests.test_error_messages.FormsErrorMessagesTestCase)", "test_choicefield (forms_tests.tests.test_e... | 475cffd1d64c690cdad16ede4d5e81985738ceb4 |
django__django-13660 | easy with tsacktrace | level 0 | django/core/management/commands/shell.py | django/django | 50c3ac6fa9b7c8a94a6d1dc87edf775e3bc4d575 | diff --git a/django/core/management/commands/shell.py b/django/core/management/commands/shell.py
--- a/django/core/management/commands/shell.py
+++ b/django/core/management/commands/shell.py
@@ -84,13 +84,13 @@ def python(self, options):
def handle(self, **options):
# Execute the command and exit.
... | diff --git a/tests/shell/tests.py b/tests/shell/tests.py
--- a/tests/shell/tests.py
+++ b/tests/shell/tests.py
@@ -9,6 +9,13 @@
class ShellCommandTestCase(SimpleTestCase):
+ script_globals = 'print("__name__" in globals())'
+ script_with_inline_function = (
+ 'import django\n'
+ 'def f():\n'
+ ... | shell command crashes when passing (with -c) the python code with functions.
Description
The examples below use Python 3.7 and Django 2.2.16, but I checked that the code is the same on master and works the same in Python 3.8.
Here's how python -c works:
$ python -c <<EOF "
import django
def f():
print(django.__ve... | PR includes tests and documents the new feature in the release notes (but not in the main docs since it seems more like a bug fix than a new feature to me). | 2020-11-09T22:43:32Z | 3.2 | ["test_command_option_inline_function_call (shell.tests.ShellCommandTestCase)", "test_stdin_read_inline_function_call (shell.tests.ShellCommandTestCase)"] | ["test_command_option (shell.tests.ShellCommandTestCase)", "test_command_option_globals (shell.tests.ShellCommandTestCase)", "test_shell_with_bpython_not_installed (shell.tests.ShellCommandTestCase)", "test_shell_with_ipython_not_installed (shell.tests.ShellCommandTestCase)", "test_stdin_read (shell.tests.ShellCommandT... | 65dfb06a1ab56c238cc80f5e1c31f61210c4577d |
django__django-16527 | easy | level 0 | django/contrib/admin/templatetags/admin_modify.py | django/django | bd366ca2aeffa869b7dbc0b0aa01caea75e6dc31 | diff --git a/django/contrib/admin/templatetags/admin_modify.py b/django/contrib/admin/templatetags/admin_modify.py
--- a/django/contrib/admin/templatetags/admin_modify.py
+++ b/django/contrib/admin/templatetags/admin_modify.py
@@ -100,7 +100,7 @@ def submit_row(context):
and context.get("show_delete", ... | diff --git a/tests/admin_views/test_templatetags.py b/tests/admin_views/test_templatetags.py
--- a/tests/admin_views/test_templatetags.py
+++ b/tests/admin_views/test_templatetags.py
@@ -3,6 +3,7 @@
from django.contrib.admin import ModelAdmin
from django.contrib.admin.templatetags.admin_list import date_hierarchy
fr... | "show_save_as_new" in admin can add without this permission
Description
(last modified by Mariusz Felisiak)
At "django/contrib/admin/templatetags/admin_modify.py" file, line 102, I think you must put one more verification for this tag: "and has_add_permission", because "save_as_new" is a add modification.
I rew... | Thanks for the report. It was previously reported in #5650 and #3817, and #3817 was closed but only with a fix for "Save and add another" (see 825f0beda804e48e9197fcf3b0d909f9f548aa47). I rewrite this for my project: "show_save_as_new": not is_popup and has_add_permission # This line that I put!!! and has_change_permis... | 2023-02-05T22:05:00Z | 5.0 | ["test_submit_row_save_as_new_add_permission_required (admin_views.test_templatetags.AdminTemplateTagsTest.test_submit_row_save_as_new_add_permission_required)"] | ["test_choice_links (admin_views.test_templatetags.DateHierarchyTests.test_choice_links)", "test_choice_links_datetime (admin_views.test_templatetags.DateHierarchyTests.test_choice_links_datetime)", "admin_modify template tags follow the standard search pattern", "admin_list template tags follow the standard search pat... | 4a72da71001f154ea60906a2f74898d32b7322a7 |
django__django-15819 | null | level 0 | django/core/management/commands/inspectdb.py | django/django | 877c800f255ccaa7abde1fb944de45d1616f5cc9 | diff --git a/django/core/management/commands/inspectdb.py b/django/core/management/commands/inspectdb.py
--- a/django/core/management/commands/inspectdb.py
+++ b/django/core/management/commands/inspectdb.py
@@ -127,12 +127,14 @@ def table2model(table_name):
yield "# The error was: %s" % e
... | diff --git a/tests/inspectdb/models.py b/tests/inspectdb/models.py
--- a/tests/inspectdb/models.py
+++ b/tests/inspectdb/models.py
@@ -9,6 +9,7 @@ class People(models.Model):
class Message(models.Model):
from_field = models.ForeignKey(People, models.CASCADE, db_column="from_id")
+ author = models.ForeignKey(... | inspectdb should generate related_name on same relation links.
Description
Hi!
After models generation with inspectdb command we have issue with relations to same enities
module.Model.field1: (fields.E304) Reverse accessor for 'module.Model.field1' clashes with reverse accessor for 'module.Model.field2'.
HINT: Add or... | FIrst solution variant was - https://github.com/django/django/pull/15816 But now I see it is not correct. I'll be back with new pull request | 2022-07-04T18:29:53Z | 4.2 | ["test_same_relations (inspectdb.tests.InspectDBTestCase)"] | ["test_composite_primary_key (inspectdb.tests.InspectDBTransactionalTests)", "inspectdb --include-views creates models for database views.", "test_attribute_name_not_python_keyword (inspectdb.tests.InspectDBTestCase)", "test_char_field_db_collation (inspectdb.tests.InspectDBTestCase)", "Introspection of columns with a ... | 0fbdb9784da915fce5dcc1fe82bac9b4785749e5 |
django__django-11564 | need to identidy FileSystemStorage seems like somewaht hard | 1st level | django/conf/__init__.py | django/django | 580e644f24f1c5ae5b94784fb73a9953a178fd26 | diff --git a/django/conf/__init__.py b/django/conf/__init__.py
--- a/django/conf/__init__.py
+++ b/django/conf/__init__.py
@@ -15,7 +15,8 @@
import django
from django.conf import global_settings
-from django.core.exceptions import ImproperlyConfigured
+from django.core.exceptions import ImproperlyConfigured, Valida... | diff --git a/tests/file_storage/tests.py b/tests/file_storage/tests.py
--- a/tests/file_storage/tests.py
+++ b/tests/file_storage/tests.py
@@ -521,7 +521,7 @@ def test_setting_changed(self):
defaults_storage = self.storage_class()
settings = {
'MEDIA_ROOT': 'overridden_media_root',
- ... | Add support for SCRIPT_NAME in STATIC_URL and MEDIA_URL
Description
(last modified by Rostyslav Bryzgunov)
By default, {% static '...' %} tag just appends STATIC_URL in the path. When running on sub-path, using SCRIPT_NAME WSGI param, it results in incorrect static URL - it doesn't prepend SCRIPT_NAME prefix.
T... | This change doesn't seem correct to me (for one, it seems like it could break existing sites). Why not include the appropriate prefix in your STATIC_URL and MEDIA_URL settings?
This is not a patch. This is just an idea I got about the patch for {% static %} only. The patch will (probably) involve FileSystemStorage and ... | 2019-07-12T21:06:28Z | 3.1 | ["test_add_script_name_prefix (settings_tests.tests.MediaURLStaticURLPrefixTest)", "test_not_prefixed (settings_tests.tests.MediaURLStaticURLPrefixTest)"] | ["test_max_recursion_error (settings_tests.tests.ClassDecoratedTestCaseSuper)", "test_override_settings_inheritance (settings_tests.tests.ChildDecoratedTestCase)", "test_method_override (settings_tests.tests.FullyDecoratedTestCase)", "test_override (settings_tests.tests.FullyDecoratedTestCase)", "test_max_recursion_err... | 0668164b4ac93a5be79f5b87fae83c657124d9ab |
django__django-12589 | file structure will help | null | django/db/models/sql/query.py | django/django | 895f28f9cbed817c00ab68770433170d83132d90 | diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py
--- a/django/db/models/sql/query.py
+++ b/django/db/models/sql/query.py
@@ -1927,6 +1927,19 @@ def set_group_by(self, allow_aliases=True):
primary key, and the query would be equivalent, the optimization
will be made automatica... | diff --git a/tests/aggregation/models.py b/tests/aggregation/models.py
--- a/tests/aggregation/models.py
+++ b/tests/aggregation/models.py
@@ -5,6 +5,7 @@ class Author(models.Model):
name = models.CharField(max_length=100)
age = models.IntegerField()
friends = models.ManyToManyField('self', blank=True)
+... | Django 3.0: "GROUP BY" clauses error with tricky field annotation
Description
Let's pretend that we have next model structure with next model's relations:
class A(models.Model):
bs = models.ManyToManyField('B',
related_name="a",
through="AB")
class B(models.Model):
pass
class AB(models.Model):
a = ... | This is due to a collision of AB.status and the status annotation. The easiest way to solve this issue is to disable group by alias when a collision is detected with involved table columns. This can be easily worked around by avoiding to use an annotation name that conflicts with involved table column names.
@Simon I t... | 2020-03-19T19:04:17Z | 3.1 | ["test_aggregation_subquery_annotation_values_collision (aggregation.tests.AggregateTestCase)"] | ["test_add_implementation (aggregation.tests.AggregateTestCase)", "test_aggregate_alias (aggregation.tests.AggregateTestCase)", "test_aggregate_annotation (aggregation.tests.AggregateTestCase)", "test_aggregate_in_order_by (aggregation.tests.AggregateTestCase)", "test_aggregate_multi_join (aggregation.tests.AggregateTe... | 0668164b4ac93a5be79f5b87fae83c657124d9ab |
django__django-12700 | easy | level 0 | django/views/debug.py | django/django | d51c50d836c5cf8db5566da17963f871be554615 | diff --git a/django/views/debug.py b/django/views/debug.py
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -90,6 +90,10 @@ def cleanse_setting(self, key, value):
cleansed = self.cleansed_substitute
elif isinstance(value, dict):
cleansed = {k: self.cleanse_settin... | diff --git a/tests/view_tests/tests/test_debug.py b/tests/view_tests/tests/test_debug.py
--- a/tests/view_tests/tests/test_debug.py
+++ b/tests/view_tests/tests/test_debug.py
@@ -1249,6 +1249,41 @@ def test_cleanse_setting_recurses_in_dictionary(self):
{'login': 'cooper', 'password': reporter_filter.cleans... | Settings are cleaned insufficiently.
Description
Posting publicly after checking with the rest of the security team.
I just ran into a case where django.views.debug.SafeExceptionReporterFilter.get_safe_settings() would return several un-cleansed values. Looking at cleanse_setting() I realized that we only take care ... | Do I need to change both versions? Or just create a single implementation for current master branch? | 2020-04-11T01:58:27Z | 3.1 | ["test_cleanse_setting_recurses_in_list_tuples (view_tests.tests.test_debug.ExceptionReporterFilterTests)"] | ["test_repr (view_tests.tests.test_debug.CallableSettingWrapperTests)", "test_sensitive_post_parameters_not_called (view_tests.tests.test_debug.DecoratorsTests)", "test_sensitive_variables_not_called (view_tests.tests.test_debug.DecoratorsTests)", "test_cleansed_substitute_override (view_tests.tests.test_debug.CustomEx... | 0668164b4ac93a5be79f5b87fae83c657124d9ab |
django__django-11039 | need to identify issue is with sqlmigrate | null | django/core/management/commands/sqlmigrate.py | django/django | d5276398046ce4a102776a1e67dcac2884d80dfe | diff --git a/django/core/management/commands/sqlmigrate.py b/django/core/management/commands/sqlmigrate.py
--- a/django/core/management/commands/sqlmigrate.py
+++ b/django/core/management/commands/sqlmigrate.py
@@ -55,8 +55,9 @@ def handle(self, *args, **options):
migration_name, app_label))
t... | diff --git a/tests/migrations/test_commands.py b/tests/migrations/test_commands.py
--- a/tests/migrations/test_commands.py
+++ b/tests/migrations/test_commands.py
@@ -536,7 +536,13 @@ def test_sqlmigrate_forwards(self):
index_op_desc_unique_together = output.find('-- alter unique_together')
index_tx_e... | sqlmigrate wraps it's outpout in BEGIN/COMMIT even if the database doesn't support transactional DDL
Description
(last modified by Simon Charette)
The migration executor only adds the outer BEGIN/COMMIT if the migration is atomic and the schema editor can rollback DDL but the current sqlmigrate logic only tak... | I marked the ticket as easy picking because I included the above guidelines but feel free to uncheck it if you deem it inappropriate. Super. We don't have enough Easy Pickings tickets for the demand, so this kind of thing is great. (IMO 🙂)
Hey, I'm working on this ticket, I would like you to know as this is my first t... | 2019-03-01T10:24:38Z | 3.0 | ["test_sqlmigrate_for_non_transactional_databases (migrations.test_commands.MigrateTests)"] | ["test_makemigrations_app_name_specified_as_label (migrations.test_commands.AppLabelErrorTests)", "test_makemigrations_nonexistent_app_label (migrations.test_commands.AppLabelErrorTests)", "test_migrate_app_name_specified_as_label (migrations.test_commands.AppLabelErrorTests)", "test_migrate_nonexistent_app_label (migr... | 419a78300f7cd27611196e1e464d50fd0385ff27 |
django__django-15498 | difficult but docstring is really helpfu to get that | null | django/views/static.py | django/django | d90e34c61b27fba2527834806639eebbcfab9631 | diff --git a/django/views/static.py b/django/views/static.py
--- a/django/views/static.py
+++ b/django/views/static.py
@@ -129,12 +129,14 @@ def was_modified_since(header=None, mtime=0, size=0):
if header is None:
raise ValueError
matches = re.match(r"^([^;]+)(; length=([0-9]+))?$", heade... | diff --git a/tests/view_tests/tests/test_static.py b/tests/view_tests/tests/test_static.py
--- a/tests/view_tests/tests/test_static.py
+++ b/tests/view_tests/tests/test_static.py
@@ -191,3 +191,6 @@ def test_was_modified_since_fp(self):
mtime = 1343416141.107817
header = http_date(mtime)
self... | Fix handling empty string for If-Modified-Since header
Description
Empty string used to be ignored for If-Modified-Since header, but now raises exception since d6aff369ad3.
Fix handling empty string for If-Modified-Since header
Description
Empty string used to be ignored for If-Modified-Since header, but now raises... | 2022-03-10T19:47:15Z | 4.1 | ["test_was_modified_since_empty_string (view_tests.tests.test_static.StaticUtilsTests)"] | ["A floating point mtime does not disturb was_modified_since (#18675).", "test_404 (view_tests.tests.test_static.StaticHelperTest)", "The static view should stream files in chunks to avoid large memory usage", "test_copes_with_empty_path_component (view_tests.tests.test_static.StaticHelperTest)", "No URLs are served if... | 647480166bfe7532e8c471fef0146e3a17e6c0c9 | |
django__django-11964 | after identifying TextChoices ( done by openai) then it is easy | level 0 | django/db/models/enums.py | django/django | fc2b1cc926e34041953738e58fa6ad3053059b22 | diff --git a/django/db/models/enums.py b/django/db/models/enums.py
--- a/django/db/models/enums.py
+++ b/django/db/models/enums.py
@@ -60,7 +60,13 @@ def values(cls):
class Choices(enum.Enum, metaclass=ChoicesMeta):
"""Class for creating enumerated choices."""
- pass
+
+ def __str__(self):
+ """
+ ... | diff --git a/tests/model_enums/tests.py b/tests/model_enums/tests.py
--- a/tests/model_enums/tests.py
+++ b/tests/model_enums/tests.py
@@ -143,6 +143,12 @@ class Fruit(models.IntegerChoices):
APPLE = 1, 'Apple'
PINEAPPLE = 1, 'Pineapple'
+ def test_str(self):
+ for test in ... | The value of a TextChoices/IntegerChoices field has a differing type
Description
If we create an instance of a model having a CharField or IntegerField with the keyword choices pointing to IntegerChoices or TextChoices, the value returned by the getter of the field will be of the same type as the one created by enum.... | Hi NyanKiyoshi, what a lovely report. Thank you. Clearly :) the expected behaviour is that test_created_object_is_str should pass. It's interesting that the underlying __dict__ values differ, which explains all I guess: Created: {'_state': <django.db.models.base.ModelState object at 0x10730efd0>, 'id': 1, 'my_str_value... | 2019-10-23T14:16:45Z | 3.1 | ["test_str (model_enums.tests.ChoicesTests)", "test_textchoices (model_enums.tests.ChoicesTests)"] | ["test_integerchoices (model_enums.tests.ChoicesTests)", "test_integerchoices_auto_label (model_enums.tests.ChoicesTests)", "test_integerchoices_containment (model_enums.tests.ChoicesTests)", "test_integerchoices_empty_label (model_enums.tests.ChoicesTests)", "test_integerchoices_functional_api (model_enums.tests.Choic... | 0668164b4ac93a5be79f5b87fae83c657124d9ab |
django__django-12453 | easy with issue description | null | django/db/backends/base/creation.py | django/django | b330b918e979ea39a21d47b61172d112caf432c3 | diff --git a/django/db/backends/base/creation.py b/django/db/backends/base/creation.py
--- a/django/db/backends/base/creation.py
+++ b/django/db/backends/base/creation.py
@@ -6,6 +6,7 @@
from django.conf import settings
from django.core import serializers
from django.db import router
+from django.db.transaction impo... | diff --git a/tests/backends/base/test_creation.py b/tests/backends/base/test_creation.py
--- a/tests/backends/base/test_creation.py
+++ b/tests/backends/base/test_creation.py
@@ -7,6 +7,8 @@
)
from django.test import SimpleTestCase
+from ..models import Object, ObjectReference
+
def get_connection_copy():
#... | `TransactionTestCase.serialized_rollback` fails to restore objects due to ordering constraints
Description
I hit this problem in a fairly complex projet and haven't had the time to write a minimal reproduction case. I think it can be understood just by inspecting the code so I'm going to describe it while I have it i... | I've run into a problem related to this one (just reported as #31051), so I ended up looking into this problem as well. The original report still seems accurate to me, with the proposed solution valid. I've been working on a fix and (most of the work), testcase for this problem. I'll do some more testing and provide a ... | 2020-02-13T20:03:27Z | 3.1 | ["test_circular_reference (backends.base.test_creation.TestDeserializeDbFromString)"] | ["test_custom_test_name (backends.base.test_creation.TestDbSignatureTests)", "test_custom_test_name_with_test_prefix (backends.base.test_creation.TestDbSignatureTests)", "test_default_name (backends.base.test_creation.TestDbSignatureTests)", "test_migrate_test_setting_false (backends.base.test_creation.TestDbCreationTe... | 0668164b4ac93a5be79f5b87fae83c657124d9ab |
django__django-14999 | easy after determining root issue as renamemodel | level 0 | django/db/migrations/operations/models.py | django/django | a754b82dac511475b6276039471ccd17cc64aeb8 | diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py
--- a/django/db/migrations/operations/models.py
+++ b/django/db/migrations/operations/models.py
@@ -320,12 +320,13 @@ def database_forwards(self, app_label, schema_editor, from_state, to_state):
new_model = to_st... | diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py
--- a/tests/migrations/test_operations.py
+++ b/tests/migrations/test_operations.py
@@ -793,6 +793,28 @@ def test_rename_model_with_m2m(self):
self.assertEqual(Rider.objects.count(), 2)
self.assertEqual(Pony._meta.g... | RenameModel with db_table should be a noop.
Description
A RenameModel operation that already has db_table defined must be a noop.
In Postgres, it drops and recreates foreign key constraints. In sqlite it recreates the table (as expected for a table renaming).
| 2021-10-16T09:31:21Z | 4.1 | ["test_rename_model_with_db_table_noop (migrations.test_operations.OperationTests)"] | ["test_references_model_mixin (migrations.test_operations.TestCreateModel)", "test_reference_field_by_through_fields (migrations.test_operations.FieldOperationTests)", "test_references_field_by_from_fields (migrations.test_operations.FieldOperationTests)", "test_references_field_by_name (migrations.test_operations.Fiel... | 647480166bfe7532e8c471fef0146e3a17e6c0c9 | |
django__django-16229 | null | null | django/forms/boundfield.py | django/django | 04b15022e8d1f49af69d8a1e6cd678f31f1280ff | diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py
--- a/django/forms/boundfield.py
+++ b/django/forms/boundfield.py
@@ -96,9 +96,17 @@ def as_widget(self, widget=None, attrs=None, only_initial=False):
attrs.setdefault(
"id", self.html_initial_id if only_initial else self... | diff --git a/tests/forms_tests/tests/tests.py b/tests/forms_tests/tests/tests.py
--- a/tests/forms_tests/tests/tests.py
+++ b/tests/forms_tests/tests/tests.py
@@ -203,6 +203,46 @@ def test_initial_instance_value(self):
""",
)
+ def test_callable_default_hidden_widget_value_not_overridden(self... | ModelForm fields with callable defaults don't correctly propagate default values
Description
When creating an object via the admin, if an inline contains an ArrayField in error, the validation will be bypassed (and the inline dismissed) if we submit the form a second time (without modification).
go to /admin/my_app/t... | First submit
Second submit
Can you reproduce this issue with Django 4.1? (or with the current main branch). Django 3.2 is in extended support so it doesn't receive bugfixes anymore (except security patches).
Replying to Mariusz Felisiak: Can you reproduce this issue with Django 4.1? (or with the current main branch). D... | 2022-10-26T11:42:55Z | 4.2 | ["test_callable_default_hidden_widget_value_not_overridden (forms_tests.tests.tests.ModelFormCallableModelDefault)"] | ["Test for issue 10405", "If a model's ManyToManyField has blank=True and is saved with no data,", "test_m2m_field_exclusion (forms_tests.tests.tests.ManyToManyExclusionTestCase)", "test_empty_field_char (forms_tests.tests.tests.Jinja2EmptyLabelTestCase)", "test_empty_field_char_none (forms_tests.tests.tests.Jinja2Empt... | 0fbdb9784da915fce5dcc1fe82bac9b4785749e5 |
django__django-14534 | need to identify id_for_label | 0 | django/forms/boundfield.py | django/django | 910ecd1b8df7678f45c3d507dde6bcb1faafa243 | diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py
--- a/django/forms/boundfield.py
+++ b/django/forms/boundfield.py
@@ -277,7 +277,7 @@ def template_name(self):
@property
def id_for_label(self):
- return 'id_%s_%s' % (self.data['name'], self.data['index'])
+ return self.data... | diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py
--- a/tests/forms_tests/tests/test_forms.py
+++ b/tests/forms_tests/tests/test_forms.py
@@ -720,7 +720,7 @@ class BeatleForm(Form):
fields = list(BeatleForm(auto_id=False)['name'])
self.assertEqual(len(fields), ... | BoundWidget.id_for_label ignores id set by ChoiceWidget.options
Description
If you look at the implementation of BoundField.subwidgets
class BoundField:
...
def subwidgets(self):
id_ = self.field.widget.attrs.get('id') or self.auto_id
attrs = {'id': id_} if id_ else {}
attrs = self.build_widget_attrs(attrs)
... | Hey Jacob — Sounds right: I didn't look in-depth but, if you can put your example in a test case it will be clear enough in the PR. Thanks.
Thanks Carlton, I will create a pull request asap.
Here is a pull request fixing this bug: https://github.com/django/django/pull/14533 (closed without merging)
Here is the new pul... | 2021-06-17T15:37:34Z | 4.0 | ["If auto_id is provided when initializing the form, the generated ID in", "test_iterable_boundfield_select (forms_tests.tests.test_forms.FormsTestCase)"] | ["test_attribute_class (forms_tests.tests.test_forms.RendererTests)", "test_attribute_instance (forms_tests.tests.test_forms.RendererTests)", "test_attribute_override (forms_tests.tests.test_forms.RendererTests)", "test_default (forms_tests.tests.test_forms.RendererTests)", "test_kwarg_class (forms_tests.tests.test_for... | 475cffd1d64c690cdad16ede4d5e81985738ceb4 |
django__django-14238 | need to identify bigautofields | 0 | django/db/models/fields/__init__.py | django/django | 30e123ed351317b7527f632b3b7dc4e81e850449 | diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -2524,7 +2524,7 @@ def __instancecheck__(self, instance):
return isinstance(instance, self._subclasses) or super().__instancecheck__(inst... | diff --git a/tests/model_fields/test_autofield.py b/tests/model_fields/test_autofield.py
--- a/tests/model_fields/test_autofield.py
+++ b/tests/model_fields/test_autofield.py
@@ -30,6 +30,18 @@ def test_isinstance_of_autofield(self):
self.assertIsInstance(field(), models.AutoField)
def test_issu... | DEFAULT_AUTO_FIELD subclass check fails for subclasses of BigAutoField and SmallAutoField.
Description
Set DEFAULT_AUTO_FIELD = "example.core.models.MyBigAutoField" , with contents of example.core.models:
from django.db import models
class MyBigAutoField(models.BigAutoField):
pass
class MyModel(models.Model):
pass
... | 2021-04-08T10:41:31Z | 4.0 | ["test_issubclass_of_autofield (model_fields.test_autofield.AutoFieldInheritanceTests)", "test_default_auto_field_setting_bigautofield_subclass (model_options.test_default_pk.TestDefaultPK)"] | ["test_isinstance_of_autofield (model_fields.test_autofield.AutoFieldInheritanceTests)", "Backend specific ranges can be saved without corruption.", "Backend specific ranges are enforced at the model validation level", "test_coercing (model_fields.test_autofield.AutoFieldTests)", "Values within the documented safe rang... | 475cffd1d64c690cdad16ede4d5e81985738ceb4 | |
django__django-11742 | need to identify Field as the root | 0 | django/db/models/fields/__init__.py | django/django | fee75d2aed4e58ada6567c464cfd22e89dc65f4a | diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
--- a/django/db/models/fields/__init__.py
+++ b/django/db/models/fields/__init__.py
@@ -257,6 +257,7 @@ def is_value(value, accept_promise=True):
)
]
+ choice_max_length = 0
# Expect [g... | diff --git a/tests/invalid_models_tests/test_ordinary_fields.py b/tests/invalid_models_tests/test_ordinary_fields.py
--- a/tests/invalid_models_tests/test_ordinary_fields.py
+++ b/tests/invalid_models_tests/test_ordinary_fields.py
@@ -304,6 +304,32 @@ class Model(models.Model):
self.assertEqual(Model._meta.g... | Add check to ensure max_length fits longest choice.
Description
There is currently no check to ensure that Field.max_length is large enough to fit the longest value in Field.choices.
This would be very helpful as often this mistake is not noticed until an attempt is made to save a record with those values that are to... | 2019-09-04T08:30:14Z | 3.0 | ["test_choices_in_max_length (invalid_models_tests.test_ordinary_fields.CharFieldTests)", "test_choices_named_group (invalid_models_tests.test_ordinary_fields.CharFieldTests)"] | ["test_non_nullable_blank (invalid_models_tests.test_ordinary_fields.GenericIPAddressFieldTests)", "test_forbidden_files_and_folders (invalid_models_tests.test_ordinary_fields.FilePathFieldTests)", "test_max_length_warning (invalid_models_tests.test_ordinary_fields.IntegerFieldTests)", "test_primary_key (invalid_models... | 419a78300f7cd27611196e1e464d50fd0385ff27 | |
django__django-14855 | easy | levcel 0 | django/contrib/admin/helpers.py | django/django | 475cffd1d64c690cdad16ede4d5e81985738ceb4 | diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py
--- a/django/contrib/admin/helpers.py
+++ b/django/contrib/admin/helpers.py
@@ -209,7 +209,11 @@ def get_admin_url(self, remote_field, remote_obj):
remote_field.model._meta.model_name,
)
try:
- url =... | diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py
--- a/tests/admin_views/admin.py
+++ b/tests/admin_views/admin.py
@@ -1142,6 +1142,8 @@ def get_formsets_with_inlines(self, request, obj=None):
raw_id_fields=['parent'],
)
site2.register(Person, save_as_continue=False)
+site2.register(ReadOnlyR... | Wrong URL generated by get_admin_url for readonly field in custom Admin Site
Description
When a model containing a ForeignKey field is viewed (or edited) in a custom Admin Site, and that ForeignKey field is listed in readonly_fields, the url generated for the link is /admin/... instead of /custom-admin/....
This appe... | Hey Ken, yes seems right. Good spot. Looks like this should have been part of b79088306513d5ed76d31ac40ab3c15f858946ea for #31181 (which was Django 3.2) here. However, I don't know if there are any side effects and I have not yet run the full suite of tests on this. Mostly looking for feedback whether I'm on the right... | 2021-09-14T01:27:01Z | 4.0 | ["test_readonly_foreignkey_links_custom_admin_site (admin_views.tests.ReadonlyTest)"] | ["test_explicitly_provided_pk (admin_views.tests.GetFormsetsWithInlinesArgumentTest)", "test_implicitly_generated_pk (admin_views.tests.GetFormsetsWithInlinesArgumentTest)", "test_should_be_able_to_edit_related_objects_on_add_view (admin_views.tests.AdminCustomSaveRelatedTests)", "test_should_be_able_to_edit_related_ob... | 475cffd1d64c690cdad16ede4d5e81985738ceb4 |
sphinx-doc__sphinx-8721 | need to identify viewcode | level 0 | sphinx/ext/viewcode.py | sphinx-doc/sphinx | 82ef497a8c88f0f6e50d84520e7276bfbf65025d | diff --git a/sphinx/ext/viewcode.py b/sphinx/ext/viewcode.py
--- a/sphinx/ext/viewcode.py
+++ b/sphinx/ext/viewcode.py
@@ -182,6 +182,10 @@ def collect_pages(app: Sphinx) -> Generator[Tuple[str, Dict[str, Any], str], Non
env = app.builder.env
if not hasattr(env, '_viewcode_modules'):
return
+ if a... | diff --git a/tests/test_ext_viewcode.py b/tests/test_ext_viewcode.py
--- a/tests/test_ext_viewcode.py
+++ b/tests/test_ext_viewcode.py
@@ -49,6 +49,21 @@ def test_viewcode(app, status, warning):
'<span> """</span></div>\n') in result
+@pytest.mark.sphinx('epub', testroot='ext-viewcode... | viewcode creates pages for epub even if `viewcode_enable_epub=False` on `make html epub`
**Describe the bug**
viewcode creates pages for epub even if `viewcode_enable_epub=False` on `make html epub`
**To Reproduce**
```
$ make html epub
```
**Expected behavior**
module pages should not be created for epub by... | 2021-01-21T15:36:24Z | 3.5 | ["tests/test_ext_viewcode.py::test_viewcode_epub_default"] | ["tests/test_ext_viewcode.py::test_viewcode_epub_enabled", "tests/test_ext_viewcode.py::test_linkcode", "tests/test_ext_viewcode.py::test_local_source_files"] | 4f8cb861e3b29186b38248fe81e4944fd987fcce | |
sphinx-doc__sphinx-8282 | file structure is the way | null | sphinx/ext/autodoc/__init__.py | sphinx-doc/sphinx | 2c2335bbb8af99fa132e1573bbf45dc91584d5a2 | diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py
--- a/sphinx/ext/autodoc/__init__.py
+++ b/sphinx/ext/autodoc/__init__.py
@@ -1240,7 +1240,9 @@ def add_directive_header(self, sig: str) -> None:
def format_signature(self, **kwargs: Any) -> str:
sigs = []
- if self.anal... | diff --git a/tests/test_ext_autodoc_configs.py b/tests/test_ext_autodoc_configs.py
--- a/tests/test_ext_autodoc_configs.py
+++ b/tests/test_ext_autodoc_configs.py
@@ -610,6 +610,54 @@ def test_autodoc_typehints_none(app):
]
+@pytest.mark.sphinx('html', testroot='ext-autodoc',
+ confoverrides... | autodoc_typehints does not effect to overloaded callables
**Describe the bug**
autodoc_typehints does not effect to overloaded callables.
**To Reproduce**
```
# in conf.py
autodoc_typehints = 'none'
```
```
# in index.rst
.. automodule:: example
:members:
:undoc-members:
```
```
# in example.py
... | 2020-10-04T09:04:48Z | 3.3 | ["tests/test_ext_autodoc_configs.py::test_autodoc_typehints_none_for_overload"] | ["tests/test_ext_autodoc_configs.py::test_autoclass_content_class", "tests/test_ext_autodoc_configs.py::test_autoclass_content_init", "tests/test_ext_autodoc_configs.py::test_autoclass_content_both", "tests/test_ext_autodoc_configs.py::test_autodoc_inherit_docstrings", "tests/test_ext_autodoc_configs.py::test_autodoc_d... | 3b85187ffa3401e88582073c23188c147857a8a3 | |
sphinx-doc__sphinx-8435 | file structure is the way | null | sphinx/ext/autodoc/__init__.py | sphinx-doc/sphinx | 5d8d6275a54f2c5fb72b82383b5712c22d337634 | diff --git a/sphinx/ext/autodoc/__init__.py b/sphinx/ext/autodoc/__init__.py
--- a/sphinx/ext/autodoc/__init__.py
+++ b/sphinx/ext/autodoc/__init__.py
@@ -1702,7 +1702,8 @@ def add_directive_header(self, sig: str) -> None:
if not self.options.annotation:
# obtain annotation for this data
... | diff --git a/tests/roots/test-ext-autodoc/target/annotations.py b/tests/roots/test-ext-autodoc/target/annotations.py
--- a/tests/roots/test-ext-autodoc/target/annotations.py
+++ b/tests/roots/test-ext-autodoc/target/annotations.py
@@ -4,6 +4,9 @@
myint = int
+#: docstring
+variable: myint
+
def sum(x: myint, y:... | autodoc_type_aliases does not effect to variables and attributes
**Describe the bug**
autodoc_type_aliases does not effect to variables and attributes
**To Reproduce**
```
# example.py
from __future__ import annotations
#: blah blah blah
var: String
class MyString:
"mystring"
#: blah bla... | 2020-11-15T17:12:24Z | 3.4 | ["tests/test_ext_autodoc_configs.py::test_autodoc_type_aliases"] | ["tests/test_ext_autodoc_configs.py::test_autoclass_content_class", "tests/test_ext_autodoc_configs.py::test_autoclass_content_init", "tests/test_ext_autodoc_configs.py::test_autoclass_content_both", "tests/test_ext_autodoc_configs.py::test_autodoc_inherit_docstrings", "tests/test_ext_autodoc_configs.py::test_autodoc_d... | 3f560cd67239f75840cc7a439ab54d8509c855f6 | |
sphinx-doc__sphinx-8713 | need to identidy _parse_other_parameters_section as root cause | 0 level | sphinx/ext/napoleon/docstring.py | sphinx-doc/sphinx | 3ed7590ed411bd93b26098faab4f23619cdb2267 | diff --git a/sphinx/ext/napoleon/docstring.py b/sphinx/ext/napoleon/docstring.py
--- a/sphinx/ext/napoleon/docstring.py
+++ b/sphinx/ext/napoleon/docstring.py
@@ -682,7 +682,13 @@ def _parse_notes_section(self, section: str) -> List[str]:
return self._parse_generic_section(_('Notes'), use_admonition)
de... | diff --git a/tests/test_ext_napoleon_docstring.py b/tests/test_ext_napoleon_docstring.py
--- a/tests/test_ext_napoleon_docstring.py
+++ b/tests/test_ext_napoleon_docstring.py
@@ -1441,12 +1441,18 @@ def test_parameters_with_class_reference(self):
----------
param1 : :class:`MyClass <name.space.MyClass>` instance
+O... | napoleon_use_param should also affect "other parameters" section
Subject: napoleon_use_param should also affect "other parameters" section
### Problem
Currently, napoleon always renders the Other parameters section as if napoleon_use_param was False, see source
```
def _parse_other_parameters_section(self, se... | 2021-01-20T14:24:12Z | 4.0 | ["tests/test_ext_napoleon_docstring.py::NumpyDocstringTest::test_parameters_with_class_reference"] | ["tests/test_ext_napoleon_docstring.py::NamedtupleSubclassTest::test_attributes_docstring", "tests/test_ext_napoleon_docstring.py::InlineAttributeTest::test_class_data_member", "tests/test_ext_napoleon_docstring.py::InlineAttributeTest::test_class_data_member_inline", "tests/test_ext_napoleon_docstring.py::InlineAttrib... | 8939a75efaa911a12dbe6edccedf261e88bf7eef | |
sphinx-doc__sphinx-7975 | need informations from description and coomets and need to identify issue is wirfh index creation logic | null | sphinx/environment/adapters/indexentries.py | sphinx-doc/sphinx | 4ec6cbe341fd84468c448e20082c778043bbea4b | diff --git a/sphinx/environment/adapters/indexentries.py b/sphinx/environment/adapters/indexentries.py
--- a/sphinx/environment/adapters/indexentries.py
+++ b/sphinx/environment/adapters/indexentries.py
@@ -98,9 +98,8 @@ def keyfunc0(entry: Tuple[str, str]) -> Tuple[bool, str]:
for subentry in indexentry[1... | diff --git a/tests/test_environment_indexentries.py b/tests/test_environment_indexentries.py
--- a/tests/test_environment_indexentries.py
+++ b/tests/test_environment_indexentries.py
@@ -25,12 +25,14 @@ def test_create_single_index(app):
".. index:: ёлка\n"
".. index:: תירבע\n"
... | Two sections called Symbols in index
When using index entries with the following leading characters: _@_, _£_, and _←_ I get two sections called _Symbols_ in the HTML output, the first containing all _@_ entries before ”normal” words and the second containing _£_ and _←_ entries after the ”normal” words. Both have the... | 2020-07-18T06:39:32Z | 3.2 | ["tests/test_environment_indexentries.py::test_create_single_index"] | ["tests/test_environment_indexentries.py::test_create_pair_index", "tests/test_environment_indexentries.py::test_create_triple_index", "tests/test_environment_indexentries.py::test_create_see_index", "tests/test_environment_indexentries.py::test_create_seealso_index", "tests/test_environment_indexentries.py::test_creat... | f92fa6443fe6f457ab0c26d41eb229e825fda5e1 | |
sphinx-doc__sphinx-8474 | null | null | sphinx/domains/std.py | sphinx-doc/sphinx | 3ea1ec84cc610f7a9f4f6b354e264565254923ff | diff --git a/sphinx/domains/std.py b/sphinx/domains/std.py
--- a/sphinx/domains/std.py
+++ b/sphinx/domains/std.py
@@ -852,8 +852,9 @@ def _resolve_numref_xref(self, env: "BuildEnvironment", fromdocname: str,
if fignumber is None:
return contnode
except ValueError:
- lo... | diff --git a/tests/test_build_html.py b/tests/test_build_html.py
--- a/tests/test_build_html.py
+++ b/tests/test_build_html.py
@@ -660,7 +660,7 @@ def test_numfig_without_numbered_toctree_warn(app, warning):
warnings = warning.getvalue()
assert 'index.rst:47: WARNING: numfig is disabled. :numref: is ignored... | v3.3 upgrade started generating "WARNING: no number is assigned for table" warnings
We've updated to Sphinx 3.3 in our documentation, and suddenly the following warning started popping up in our builds when we build either `singlehtml` or `latex`.:
`WARNING: no number is assigned for table:`
I looked through the ... | I digged into this a little bit more and it seems like the `id` of the table isn't properly making it into `env.toc_fignumbers`. If I set `:name: mylabel`, regardless the I see something like this in `env.toc_fignumbers`
```
'pagename': {'table': {'id3': (1,)},
```
So it seems like `id3` is being used for the ... | 2020-11-22T16:24:25Z | 3.4 | ["tests/test_build_html.py::test_numfig_without_numbered_toctree_warn", "tests/test_build_html.py::test_numfig_with_numbered_toctree_warn", "tests/test_build_html.py::test_numfig_with_prefix_warn", "tests/test_build_html.py::test_numfig_with_secnum_depth_warn"] | ["tests/test_build_html.py::test_html4_output", "tests/test_build_html.py::test_html5_output[images.html-expect0]", "tests/test_build_html.py::test_html5_output[images.html-expect1]", "tests/test_build_html.py::test_html5_output[images.html-expect2]", "tests/test_build_html.py::test_html5_output[images.html-expect3]", ... | 3f560cd67239f75840cc7a439ab54d8509c855f6 |
sphinx-doc__sphinx-8273 | file strcuture | null | sphinx/builders/manpage.py | sphinx-doc/sphinx | 88b81a06eb635a1596617f8971fa97a84c069e93 | diff --git a/sphinx/builders/manpage.py b/sphinx/builders/manpage.py
--- a/sphinx/builders/manpage.py
+++ b/sphinx/builders/manpage.py
@@ -24,7 +24,7 @@
from sphinx.util import progress_message
from sphinx.util.console import darkgreen # type: ignore
from sphinx.util.nodes import inline_all_toctrees
-from sphinx.ut... | diff --git a/tests/test_build_manpage.py b/tests/test_build_manpage.py
--- a/tests/test_build_manpage.py
+++ b/tests/test_build_manpage.py
@@ -30,6 +30,13 @@ def test_all(app, status, warning):
assert 'Footnotes' not in content
+@pytest.mark.sphinx('man', testroot='basic',
+ confoverrides={'... | Generate man page section directories
**Current man page generation does not conform to `MANPATH` search functionality**
Currently, all generated man pages are placed in to a single-level directory: `<build-dir>/man`. Unfortunately, this cannot be used in combination with the unix `MANPATH` environment variable. The `... | I think that users should copy the generated man file to the appropriate directory. The build directory is not an appropriate directory to manage man pages. So no section directory is needed, AFAIK. I don't know why do you want to set `MANPATH` to the output directory. To check the output, you can give the path to the ... | 2020-10-03T13:31:13Z | 3.3 | ["tests/test_build_manpage.py::test_man_make_section_directory"] | ["tests/test_build_manpage.py::test_all", "tests/test_build_manpage.py::test_default_man_pages", "tests/test_build_manpage.py::test_rubric"] | 3b85187ffa3401e88582073c23188c147857a8a3 |
scikit-learn__scikit-learn-10508 | easy after identifying root cause as scikit-learn__scikit-learn | 0 | sklearn/preprocessing/label.py | scikit-learn/scikit-learn | c753b77ac49e72ebc0fe5e3c2369fe628f975017 | diff --git a/sklearn/preprocessing/label.py b/sklearn/preprocessing/label.py
--- a/sklearn/preprocessing/label.py
+++ b/sklearn/preprocessing/label.py
@@ -126,6 +126,9 @@ def transform(self, y):
"""
check_is_fitted(self, 'classes_')
y = column_or_1d(y, warn=True)
+ # transform of empty... | diff --git a/sklearn/preprocessing/tests/test_label.py b/sklearn/preprocessing/tests/test_label.py
--- a/sklearn/preprocessing/tests/test_label.py
+++ b/sklearn/preprocessing/tests/test_label.py
@@ -208,6 +208,21 @@ def test_label_encoder_errors():
assert_raise_message(ValueError, msg, le.inverse_transform, [-2])
... | LabelEncoder transform fails for empty lists (for certain inputs)
Python 3.6.3, scikit_learn 0.19.1
Depending on which datatypes were used to fit the LabelEncoder, transforming empty lists works or not. Expected behavior would be that empty arrays are returned in both cases.
```python
>>> from sklearn.preprocess... | `le.transform([])` will trigger an numpy array of `dtype=np.float64` and you fit something which was some string.
```python
from sklearn.preprocessing import LabelEncoder
import numpy as np
... | 2018-01-19T18:00:29Z | 0.20 | ["sklearn/preprocessing/tests/test_label.py::test_label_encoder_errors", "sklearn/preprocessing/tests/test_label.py::test_label_encoder_empty_array"] | ["sklearn/preprocessing/tests/test_label.py::test_label_binarizer", "sklearn/preprocessing/tests/test_label.py::test_label_binarizer_unseen_labels", "sklearn/preprocessing/tests/test_label.py::test_label_binarizer_set_label_encoding", "sklearn/preprocessing/tests/test_label.py::test_label_binarizer_errors", "sklearn/pr... | 55bf5d93e5674f13a1134d93a11fd0cd11aabcd1 |
scikit-learn__scikit-learn-13142 | need to identify root cause as GaussianMixture | 1 | sklearn/mixture/base.py | scikit-learn/scikit-learn | 1c8668b0a021832386470ddf740d834e02c66f69 | diff --git a/sklearn/mixture/base.py b/sklearn/mixture/base.py
--- a/sklearn/mixture/base.py
+++ b/sklearn/mixture/base.py
@@ -257,11 +257,6 @@ def fit_predict(self, X, y=None):
best_params = self._get_parameters()
best_n_iter = n_iter
- # Always do a final e-step to guarantee... | diff --git a/sklearn/mixture/tests/test_bayesian_mixture.py b/sklearn/mixture/tests/test_bayesian_mixture.py
--- a/sklearn/mixture/tests/test_bayesian_mixture.py
+++ b/sklearn/mixture/tests/test_bayesian_mixture.py
@@ -451,6 +451,15 @@ def test_bayesian_mixture_fit_predict(seed, max_iter, tol):
assert_array_eq... | GaussianMixture predict and fit_predict disagree when n_init>1
#### Description
When `n_init` is specified in GaussianMixture, the results of fit_predict(X) and predict(X) are often different. The `test_gaussian_mixture_fit_predict` unit test doesn't catch this because it does not set `n_init`.
#### Steps/Code to ... | Indeed the code in fit_predict and the one in predict are not exactly consistent. This should be fixed but we would need to check the math to choose the correct variant, add a test and remove the other one.
I don't think the math is wrong or inconsistent. I think it's a matter of `fit_predict` returning the fit from t... | 2019-02-12T14:32:37Z | 0.21 | ["sklearn/mixture/tests/test_bayesian_mixture.py::test_bayesian_mixture_fit_predict_n_init", "sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_fit_predict_n_init"] | ["sklearn/mixture/tests/test_bayesian_mixture.py::test_log_dirichlet_norm", "sklearn/mixture/tests/test_bayesian_mixture.py::test_log_wishart_norm", "sklearn/mixture/tests/test_bayesian_mixture.py::test_bayesian_mixture_covariance_type", "sklearn/mixture/tests/test_bayesian_mixture.py::test_bayesian_mixture_weight_conc... | 7813f7efb5b2012412888b69e73d76f2df2b50b6 |
scikit-learn__scikit-learn-13779 | need to identify VotingClassifier as root cause file level also can help | 0 | sklearn/ensemble/voting.py | scikit-learn/scikit-learn | b34751b7ed02b2cfcc36037fb729d4360480a299 | diff --git a/sklearn/ensemble/voting.py b/sklearn/ensemble/voting.py
--- a/sklearn/ensemble/voting.py
+++ b/sklearn/ensemble/voting.py
@@ -78,6 +78,8 @@ def fit(self, X, y, sample_weight=None):
if sample_weight is not None:
for name, step in self.estimators:
+ if step is None:
+ ... | diff --git a/sklearn/ensemble/tests/test_voting.py b/sklearn/ensemble/tests/test_voting.py
--- a/sklearn/ensemble/tests/test_voting.py
+++ b/sklearn/ensemble/tests/test_voting.py
@@ -8,9 +8,11 @@
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_raise_message
from sklearn.except... | Voting estimator will fail at fit if weights are passed and an estimator is None
Because we don't check for an estimator to be `None` in `sample_weight` support, `fit` is failing`.
```python
X, y = load_iris(return_X_y=True)
voter = VotingClassifier(
estimators=[('lr', LogisticRegression()),
... | 2019-05-03T13:24:57Z | 0.22 | ["sklearn/ensemble/tests/test_voting.py::test_none_estimator_with_weights[X0-y0-voter0]", "sklearn/ensemble/tests/test_voting.py::test_none_estimator_with_weights[X1-y1-voter1]"] | ["sklearn/ensemble/tests/test_voting.py::test_estimator_init", "sklearn/ensemble/tests/test_voting.py::test_predictproba_hardvoting", "sklearn/ensemble/tests/test_voting.py::test_notfitted", "sklearn/ensemble/tests/test_voting.py::test_majority_label_iris", "sklearn/ensemble/tests/test_voting.py::test_tie_situation", "... | 7e85a6d1f038bbb932b36f18d75df6be937ed00d | |
scikit-learn__scikit-learn-10949 | identify root cause as check_array | 0 | sklearn/utils/validation.py | scikit-learn/scikit-learn | 3b5abf76597ce6aff76192869f92647c1b5259e7 | diff --git a/sklearn/utils/validation.py b/sklearn/utils/validation.py
--- a/sklearn/utils/validation.py
+++ b/sklearn/utils/validation.py
@@ -466,6 +466,12 @@ def check_array(array, accept_sparse=False, accept_large_sparse=True,
# not a data type (e.g. a column named dtype in a pandas DataFrame)
dtyp... | diff --git a/sklearn/utils/tests/test_validation.py b/sklearn/utils/tests/test_validation.py
--- a/sklearn/utils/tests/test_validation.py
+++ b/sklearn/utils/tests/test_validation.py
@@ -7,6 +7,7 @@
from itertools import product
import pytest
+from pytest import importorskip
import numpy as np
import scipy.sparse... | warn_on_dtype with DataFrame
#### Description
``warn_on_dtype`` has no effect when input is a pandas ``DataFrame``
#### Steps/Code to Reproduce
```python
from sklearn.utils.validation import check_array
import pandas as pd
df = pd.DataFrame([[1, 2, 3], [2, 3, 4]], dtype=object)
checked = check_array(df, warn... | 2018-04-10T15:30:56Z | 0.20 | ["sklearn/utils/tests/test_validation.py::test_check_dataframe_warns_on_dtype"] | ["sklearn/utils/tests/test_validation.py::test_as_float_array", "sklearn/utils/tests/test_validation.py::test_as_float_array_nan[X0]", "sklearn/utils/tests/test_validation.py::test_as_float_array_nan[X1]", "sklearn/utils/tests/test_validation.py::test_np_matrix", "sklearn/utils/tests/test_validation.py::test_memmap", "... | 55bf5d93e5674f13a1134d93a11fd0cd11aabcd1 | |
scikit-learn__scikit-learn-13584 | file structure might solve | null | sklearn/utils/_pprint.py | scikit-learn/scikit-learn | 0e3c1879b06d839171b7d0a607d71bbb19a966a9 | diff --git a/sklearn/utils/_pprint.py b/sklearn/utils/_pprint.py
--- a/sklearn/utils/_pprint.py
+++ b/sklearn/utils/_pprint.py
@@ -95,7 +95,7 @@ def _changed_params(estimator):
init_params = signature(init_func).parameters
init_params = {name: param.default for name, param in init_params.items()}
for k, ... | diff --git a/sklearn/utils/tests/test_pprint.py b/sklearn/utils/tests/test_pprint.py
--- a/sklearn/utils/tests/test_pprint.py
+++ b/sklearn/utils/tests/test_pprint.py
@@ -4,6 +4,7 @@
import numpy as np
from sklearn.utils._pprint import _EstimatorPrettyPrinter
+from sklearn.linear_model import LogisticRegressionCV
... | bug in print_changed_only in new repr: vector values
```python
import sklearn
import numpy as np
from sklearn.linear_model import LogisticRegressionCV
sklearn.set_config(print_changed_only=True)
print(LogisticRegressionCV(Cs=np.array([0.1, 1])))
```
> ValueError: The truth value of an array with more than one el... | 2019-04-05T23:09:48Z | 0.21 | ["sklearn/utils/tests/test_pprint.py::test_changed_only", "sklearn/utils/tests/test_pprint.py::test_pipeline", "sklearn/utils/tests/test_pprint.py::test_deeply_nested", "sklearn/utils/tests/test_pprint.py::test_gridsearch", "sklearn/utils/tests/test_pprint.py::test_gridsearch_pipeline", "sklearn/utils/tests/test_pprint... | ["sklearn/utils/tests/test_pprint.py::test_basic", "sklearn/utils/tests/test_pprint.py::test_length_constraint", "sklearn/utils/tests/test_pprint.py::test_builtin_prettyprinter"] | 7813f7efb5b2012412888b69e73d76f2df2b50b6 | |
scikit-learn__scikit-learn-14087 | need to identify LogisticRegressionCv as the root | 0 | sklearn/linear_model/logistic.py | scikit-learn/scikit-learn | a5743ed36fbd3fbc8e351bdab16561fbfca7dfa1 | diff --git a/sklearn/linear_model/logistic.py b/sklearn/linear_model/logistic.py
--- a/sklearn/linear_model/logistic.py
+++ b/sklearn/linear_model/logistic.py
@@ -2170,7 +2170,7 @@ def fit(self, X, y, sample_weight=None):
# Take the best scores across every fold and the average of
# al... | diff --git a/sklearn/linear_model/tests/test_logistic.py b/sklearn/linear_model/tests/test_logistic.py
--- a/sklearn/linear_model/tests/test_logistic.py
+++ b/sklearn/linear_model/tests/test_logistic.py
@@ -1532,8 +1532,9 @@ def test_LogisticRegressionCV_GridSearchCV_elastic_net_ovr():
assert (lrcv.predict(X_test)... | IndexError thrown with LogisticRegressionCV and refit=False
#### Description
The following error is thrown when trying to estimate a regularization parameter via cross-validation, *without* refitting.
#### Steps/Code to Reproduce
```python
import sys
import sklearn
from sklearn.linear_model import LogisticRegre... | I.e. coefs_paths.ndim < 4? I haven't tried to reproduce yet, but thanks for
the minimal example.
Are you able to check if this was introduced in 0.21?
Yes - the example above works with scikit-learn==0.20.3. Full versions:
```
System:
python: 3.6.8 (default, Jun 4 2019, 11:38:34) [GCC 4.2.1 Compatible Apple ... | 2019-06-13T20:09:22Z | 0.22 | ["sklearn/linear_model/tests/test_logistic.py::test_LogisticRegressionCV_no_refit[ovr-l2]", "sklearn/linear_model/tests/test_logistic.py::test_LogisticRegressionCV_no_refit[multinomial-l2]", "sklearn/linear_model/tests/test_logistic.py::test_LogisticRegressionCV_no_refit[auto-l2]"] | ["sklearn/linear_model/tests/test_logistic.py::test_predict_2_classes", "sklearn/linear_model/tests/test_logistic.py::test_error", "sklearn/linear_model/tests/test_logistic.py::test_logistic_cv_mock_scorer", "sklearn/linear_model/tests/test_logistic.py::test_logistic_cv_score_does_not_warn_by_default", "sklearn/linear_... | 7e85a6d1f038bbb932b36f18d75df6be937ed00d |
scikit-learn__scikit-learn-14092 | need to identify NeighborhoodComponentsAnalysis as rrot | 0 | sklearn/neighbors/nca.py | scikit-learn/scikit-learn | df7dd8391148a873d157328a4f0328528a0c4ed9 | diff --git a/sklearn/neighbors/nca.py b/sklearn/neighbors/nca.py
--- a/sklearn/neighbors/nca.py
+++ b/sklearn/neighbors/nca.py
@@ -13,6 +13,7 @@
import numpy as np
import sys
import time
+import numbers
from scipy.optimize import minimize
from ..utils.extmath import softmax
from ..metrics import pairwise_distance... | diff --git a/sklearn/neighbors/tests/test_nca.py b/sklearn/neighbors/tests/test_nca.py
--- a/sklearn/neighbors/tests/test_nca.py
+++ b/sklearn/neighbors/tests/test_nca.py
@@ -129,7 +129,7 @@ def test_params_validation():
# TypeError
assert_raises(TypeError, NCA(max_iter='21').fit, X, y)
assert_raises(Typ... | NCA fails in GridSearch due to too strict parameter checks
NCA checks its parameters to have a specific type, which can easily fail in a GridSearch due to how param grid is made.
Here is an example:
```python
import numpy as np
from sklearn.pipeline import Pipeline
from sklearn.model_selection import GridSearc... | I have developed a framework, experimenting with parameter verification: https://github.com/thomasjpfan/skconfig (Don't expect the API to be stable)
Your idea of using a simple dict for union types is really nice!
Edit: I am currently trying out another idea. I'll update this issue when it becomes something prese... | 2019-06-14T14:16:17Z | 0.22 | ["sklearn/neighbors/tests/test_nca.py::test_parameters_valid_types[n_components-value0]", "sklearn/neighbors/tests/test_nca.py::test_parameters_valid_types[max_iter-value1]", "sklearn/neighbors/tests/test_nca.py::test_parameters_valid_types[tol-value2]"] | ["sklearn/neighbors/tests/test_nca.py::test_simple_example", "sklearn/neighbors/tests/test_nca.py::test_toy_example_collapse_points", "sklearn/neighbors/tests/test_nca.py::test_finite_differences", "sklearn/neighbors/tests/test_nca.py::test_params_validation", "sklearn/neighbors/tests/test_nca.py::test_transformation_d... | 7e85a6d1f038bbb932b36f18d75df6be937ed00d |
scikit-learn__scikit-learn-11281 | file structure might work | null | sklearn/mixture/base.py | scikit-learn/scikit-learn | 4143356c3c51831300789e4fdf795d83716dbab6 | diff --git a/sklearn/mixture/base.py b/sklearn/mixture/base.py
--- a/sklearn/mixture/base.py
+++ b/sklearn/mixture/base.py
@@ -172,7 +172,7 @@ def _initialize(self, X, resp):
def fit(self, X, y=None):
"""Estimate model parameters with the EM algorithm.
- The method fit the model `n_init` times an... | diff --git a/sklearn/mixture/tests/test_bayesian_mixture.py b/sklearn/mixture/tests/test_bayesian_mixture.py
--- a/sklearn/mixture/tests/test_bayesian_mixture.py
+++ b/sklearn/mixture/tests/test_bayesian_mixture.py
@@ -1,12 +1,16 @@
# Author: Wei Xue <xuewei4d@gmail.com>
# Thierry Guillemot <thierry.guillemot... | Should mixture models have a clusterer-compatible interface
Mixture models are currently a bit different. They are basically clusterers, except they are probabilistic, and are applied to inductive problems unlike many clusterers. But they are unlike clusterers in API:
* they have an `n_components` parameter, with iden... | In my opinion, yes.
I wanted to compare K-Means, GMM and HDBSCAN and was very disappointed that GMM does not have a `fit_predict` method. The HDBSCAN examples use `fit_predict`, so I was expecting GMM to have the same interface.
I think we should add ``fit_predict`` at least. I wouldn't rename ``n_components``.
I wo... | 2018-06-15T17:15:25Z | 0.20 | ["sklearn/mixture/tests/test_bayesian_mixture.py::test_bayesian_mixture_fit_predict", "sklearn/mixture/tests/test_gaussian_mixture.py::test_gaussian_mixture_fit_predict"] | ["sklearn/mixture/tests/test_bayesian_mixture.py::test_log_dirichlet_norm", "sklearn/mixture/tests/test_bayesian_mixture.py::test_log_wishart_norm", "sklearn/mixture/tests/test_bayesian_mixture.py::test_bayesian_mixture_covariance_type", "sklearn/mixture/tests/test_bayesian_mixture.py::test_bayesian_mixture_weight_conc... | 55bf5d93e5674f13a1134d93a11fd0cd11aabcd1 |
scikit-learn__scikit-learn-25570 | COlumn transfer identify | level 0 | sklearn/compose/_column_transformer.py | scikit-learn/scikit-learn | cd25abee0ad0ac95225d4a9be8948eff69f49690 | diff --git a/sklearn/compose/_column_transformer.py b/sklearn/compose/_column_transformer.py
--- a/sklearn/compose/_column_transformer.py
+++ b/sklearn/compose/_column_transformer.py
@@ -865,7 +865,9 @@ def _hstack(self, Xs):
transformer_names = [
t[0] for t in self._iter(fitted=Tr... | diff --git a/sklearn/compose/tests/test_column_transformer.py b/sklearn/compose/tests/test_column_transformer.py
--- a/sklearn/compose/tests/test_column_transformer.py
+++ b/sklearn/compose/tests/test_column_transformer.py
@@ -2129,3 +2129,32 @@ def test_transformers_with_pandas_out_but_not_feature_names_out(
ct.s... | ColumnTransformer with pandas output can't handle transformers with no features
### Describe the bug
Hi,
ColumnTransformer doesn't deal well with transformers that apply to 0 features (categorical_features in the example below) when using "pandas" as output. It seems steps with 0 features are not fitted, hence do... | 2023-02-08T18:28:21Z | 1.3 | ["sklearn/compose/tests/test_column_transformer.py::test_empty_selection_pandas_output[list]", "sklearn/compose/tests/test_column_transformer.py::test_empty_selection_pandas_output[bool]", "sklearn/compose/tests/test_column_transformer.py::test_empty_selection_pandas_output[bool_int]"] | ["sklearn/compose/tests/test_column_transformer.py::test_column_transformer", "sklearn/compose/tests/test_column_transformer.py::test_column_transformer_tuple_transformers_parameter", "sklearn/compose/tests/test_column_transformer.py::test_column_transformer_dataframe", "sklearn/compose/tests/test_column_transformer.py... | 1e8a5b833d1b58f3ab84099c4582239af854b23a |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.