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 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 10