instance_id stringlengths 20 20 | feedback stringlengths 5 152 ⌀ | level int64 0 2 | erroneous_file stringlengths 21 49 | repo stringclasses 1
value | base_commit stringlengths 40 40 | patch stringlengths 386 2.03k | test_patch stringlengths 488 4.45k | problem_statement stringlengths 262 4.67k | hints_text stringlengths 0 9.06k | created_at stringdate 2019-02-03 11:30:12 2023-02-05 22:05:00 | version stringclasses 7
values | FAIL_TO_PASS stringlengths 52 310 | PASS_TO_PASS stringlengths 66 11.1k | environment_setup_commit stringclasses 7
values |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
django__django-15202 | Retreival is straightford correct file is the last stacktrace that has valid path | 1 | 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-14017 | Retreival is straightford correct file is the last stacktrace that has valid path | 0 | 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 | 0 | 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 | 0 | 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 | 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 | 1 | 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-11583 | null | 0 | 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-11620 | quite difficult to identify file as debug.py | 2 | 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) | 1 | 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 | 1 | 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 | 1 | 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 | 1 | 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 | 0 | 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-11905 | only possibility with isnull but it has not followed exact capital sinple format in issue description | 0 | 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 | 0 | 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 | 0 | 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 | 1 | 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 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 6