repo string | instance_id string | base_commit string | patch string | test_patch string | problem_statement string | hints_text string | created_at string | version string | FAIL_TO_PASS string | PASS_TO_PASS string | environment_setup_commit string | difficulty string |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
django/django | django__django-10554 | 14d026cccb144c6877294ba4cd4e03ebf0842498 | 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
@@ -356,7 +356,12 @@ def get_order_by(self):
resolved.set_source_expressions([RawSQL('%d' % (idx + 1), ())])
br... | diff --git a/tests/queries/test_qs_combinators.py b/tests/queries/test_qs_combinators.py
--- a/tests/queries/test_qs_combinators.py
+++ b/tests/queries/test_qs_combinators.py
@@ -153,6 +153,29 @@ def test_union_with_values_list_on_annotated_and_unannotated(self):
qs2 = Number.objects.filter(num=9)
sel... | Union queryset with ordering breaks on ordering with derived querysets
Description
(last modified by Sergei Maertens)
May be related to #29692
Simple reproduction (the exact models are not relevant I think):
>>> Dimension.objects.values_list('id', flat=True)
<QuerySet [10, 11, 12, 13, 14, 15, 16, 17, 18]>
>>> q... | Looks like a bug caused by a .query attribute change without performing a prior copy() of the query/queryset.
Attaching a regression test that fails on master (tested at f3d3338e06d571a529bb2046428eeac8e56bcbf6).
PR
Tests aren't passing.
Needs more tests, at the least. But discussion on PR suggests we've not hit the r... | 2018-10-24T14:24:45Z | 3.0 | ["test_union_with_values_list_and_order (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_union_with_values_list_on_annotated_and_unannotated (queries.test_qs_combinators.QuerySetSetOperationTests)"] | ["test_combining_multiple_models (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_count_difference (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_count_intersection (queries.test_qs_combinators.QuerySetSetOperationTests)", "test_count_union (queries.test_qs_combinators.QuerySetSetOperati... | 419a78300f7cd27611196e1e464d50fd0385ff27 | 1-4 hours |
django/django | django__django-10973 | ddb293685235fd09e932805771ae97f72e817181 | diff --git a/django/db/backends/postgresql/client.py b/django/db/backends/postgresql/client.py
--- a/django/db/backends/postgresql/client.py
+++ b/django/db/backends/postgresql/client.py
@@ -2,17 +2,9 @@
import signal
import subprocess
-from django.core.files.temp import NamedTemporaryFile
from django.db.backends.... | diff --git a/tests/dbshell/test_postgresql.py b/tests/dbshell/test_postgresql.py
--- a/tests/dbshell/test_postgresql.py
+++ b/tests/dbshell/test_postgresql.py
@@ -1,5 +1,6 @@
import os
import signal
+import subprocess
from unittest import mock
from django.db.backends.postgresql.client import DatabaseClient
@@ -11... | Use subprocess.run and PGPASSWORD for client in postgres backend
Description
subprocess.run was added in python 3.5 (which is the minimum version since Django 2.1). This function allows you to pass a custom environment for the subprocess.
Using this in django.db.backends.postgres.client to set PGPASSWORD simplifies ... | 2019-02-11T01:19:56Z | 3.0 | ["test_accent (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_basic (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_column (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "test_nopass (dbshell.test_postgresql.PostgreSqlDbshellCommandTestCase)", "SIGINT is ignored in Py... | [] | 419a78300f7cd27611196e1e464d50fd0385ff27 | 15 min - 1 hour | |
django/django | django__django-10999 | 36300ef336e3f130a0dadc1143163ff3d23dc843 | diff --git a/django/utils/dateparse.py b/django/utils/dateparse.py
--- a/django/utils/dateparse.py
+++ b/django/utils/dateparse.py
@@ -29,9 +29,10 @@
standard_duration_re = re.compile(
r'^'
r'(?:(?P<days>-?\d+) (days?, )?)?'
- r'((?:(?P<hours>-?\d+):)(?=\d+:\d+))?'
- r'(?:(?P<minutes>-?\d+):)?'
- r'... | diff --git a/tests/utils_tests/test_dateparse.py b/tests/utils_tests/test_dateparse.py
--- a/tests/utils_tests/test_dateparse.py
+++ b/tests/utils_tests/test_dateparse.py
@@ -113,9 +113,12 @@ def test_negative(self):
test_values = (
('-4 15:30', timedelta(days=-4, minutes=15, seconds=30)),
... | Fix parse_duration() for some negative durations
Description
The https://docs.djangoproject.com/en/2.1/_modules/django/utils/dateparse/ defines:
standard_duration_re = re.compile(
r'^'
r'(?:(?P<days>-?\d+) (days?, )?)?'
r'((?:(?P<hours>-?\d+):)(?=\d+:\d+))?'
r'(?:(?P<minutes>-?\d+):)?'
r'(?P<seconds>-?\d+)'
r'... | Please give an example valid that's not working. There are some tests for negative values.
Right, this should have been fixed by #27699 which is included in 1.11.x.
Example cases, can be discussed: parse_duration('-00:01:01') => plus 61 seconds, so it is not -(00:01:01) but (-00):(+01):(+01) parse_duration('00:-01:-01... | 2019-02-16T07:44:50Z | 3.0 | ["test_negative (utils_tests.test_dateparse.DurationParseTests)", "test_parse_postgresql_format (utils_tests.test_dateparse.DurationParseTests)"] | ["test_parse_date (utils_tests.test_dateparse.DateParseTests)", "test_parse_datetime (utils_tests.test_dateparse.DateParseTests)", "test_parse_time (utils_tests.test_dateparse.DateParseTests)", "test_days (utils_tests.test_dateparse.DurationParseTests)", "test_fractions_of_seconds (utils_tests.test_dateparse.DurationPa... | 419a78300f7cd27611196e1e464d50fd0385ff27 | <15 min fix |
django/django | django__django-11087 | 8180ffba21bf10f4be905cb0d4890dc2bcff2788 | 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
@@ -1,4 +1,5 @@
from collections import Counter
+from itertools import chain
from operator import attrgetter
from django.db import IntegrityError, connections, transaction
... | diff --git a/tests/delete/models.py b/tests/delete/models.py
--- a/tests/delete/models.py
+++ b/tests/delete/models.py
@@ -126,3 +126,20 @@ class Base(models.Model):
class RelToBase(models.Model):
base = models.ForeignKey(Base, models.DO_NOTHING)
+
+
+class Origin(models.Model):
+ pass
+
+
+class Referrer(mo... | Optimize .delete() to use only required fields.
Description
Hi!
We're in the process of upgrading our Django 1.11 installation from Python 2.7 to Python 3.6, however are hitting an unexpected UnicodeDecodeError during a .delete() run by our daily data purging management command.
STR:
Have an existing Django 1.11 proj... | I think this would have been better posted elsewhere. See TicketClosingReasons/UseSupportChannels. However... Create some instances: >>> Group.objects.create(name="a") INSERT INTO "auth_group" ("name") VALUES ('a') RETURNING "auth_group"."id"; args=('a',) [utils.py:111] <Group: a> >>> Group.objects.create(name="b") INS... | 2019-03-16T22:59:57Z | 3.0 | ["test_only_referenced_fields_selected (delete.tests.DeletionTests)"] | ["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_instance_set_pk_none (delete.tests.FastDeleteTests)", "test_fast_delete_joined_qs (delete.tests.FastD... | 419a78300f7cd27611196e1e464d50fd0385ff27 | 15 min - 1 hour |
django/django | django__django-11133 | 879cc3da6249e920b8d54518a0ae06de835d7373 | diff --git a/django/http/response.py b/django/http/response.py
--- a/django/http/response.py
+++ b/django/http/response.py
@@ -229,7 +229,7 @@ def make_bytes(self, value):
# Handle string types -- we can't rely on force_bytes here because:
# - Python attempts str conversion first
# - when sel... | diff --git a/tests/httpwrappers/tests.py b/tests/httpwrappers/tests.py
--- a/tests/httpwrappers/tests.py
+++ b/tests/httpwrappers/tests.py
@@ -366,6 +366,10 @@ def test_non_string_content(self):
r.content = 12345
self.assertEqual(r.content, b'12345')
+ def test_memoryview_content(self):
+ ... | HttpResponse doesn't handle memoryview objects
Description
I am trying to write a BinaryField retrieved from the database into a HttpResponse. When the database is Sqlite this works correctly, but Postgresql returns the contents of the field as a memoryview object and it seems like current Django doesn't like this co... | I guess HttpResponseBase.make_bytes could be adapted to deal with memoryview objects by casting them to bytes. In all cases simply wrapping the memoryview in bytes works as a workaround HttpResponse(bytes(model.binary_field)).
The fact make_bytes would still use force_bytes if da56e1bac6449daef9aeab8d076d2594d9fd5b44 ... | 2019-03-27T06:48:09Z | 3.0 | ["test_memoryview_content (httpwrappers.tests.HttpResponseTests)"] | ["test_streaming_response (httpwrappers.tests.StreamingHttpResponseTests)", "test_cookie_edgecases (httpwrappers.tests.CookieTests)", "Semicolons and commas are decoded.", "Semicolons and commas are encoded.", "test_httponly_after_load (httpwrappers.tests.CookieTests)", "test_invalid_cookies (httpwrappers.tests.CookieT... | 419a78300f7cd27611196e1e464d50fd0385ff27 | <15 min fix |
django/django | django__django-11138 | c84b91b7603e488f7171fdff8f08368ef3d6b856 | diff --git a/django/db/backends/mysql/operations.py b/django/db/backends/mysql/operations.py
--- a/django/db/backends/mysql/operations.py
+++ b/django/db/backends/mysql/operations.py
@@ -69,8 +69,8 @@ def date_trunc_sql(self, lookup_type, field_name):
return "DATE(%s)" % (field_name)
def _convert_fi... | diff --git a/tests/timezones/tests.py b/tests/timezones/tests.py
--- a/tests/timezones/tests.py
+++ b/tests/timezones/tests.py
@@ -47,6 +47,26 @@
ICT = timezone.get_fixed_timezone(420) # Asia/Bangkok
+@contextmanager
+def override_database_connection_timezone(timezone):
+ try:
+ orig_timezone = conn... | TIME_ZONE value in DATABASES settings is not used when making dates timezone-aware on MySQL, SQLite, and Oracle.
Description
(last modified by Victor Talpaert)
(We assume the mysql backends)
I can set TIME_ZONE several times in settings.py, one for the global django app, and one for each database (see https://... | Opened a pull request on github with a quick fix, it's tested but lacks a TestCase https://github.com/django/django/pull/8714
Looks reasonable at a brief review.
PR | 2019-03-28T13:11:56Z | 3.0 | ["test_query_convert_timezones (timezones.tests.NewDatabaseTests)"] | ["test_aware_datetime_in_utc (timezones.tests.SerializationTests)", "test_naive_datetime (timezones.tests.SerializationTests)", "test_naive_datetime_with_microsecond (timezones.tests.SerializationTests)", "test_auto_now_and_auto_now_add (timezones.tests.LegacyDatabaseTests)", "test_aware_datetime_unsupported (timezones... | 419a78300f7cd27611196e1e464d50fd0385ff27 | 1-4 hours |
django/django | django__django-11141 | 5d9cf79baf07fc4aed7ad1b06990532a65378155 | diff --git a/django/db/migrations/loader.py b/django/db/migrations/loader.py
--- a/django/db/migrations/loader.py
+++ b/django/db/migrations/loader.py
@@ -84,11 +84,6 @@ def load_disk(self):
continue
raise
else:
- # Empty directories are namespaces.
- ... | diff --git a/tests/migrations/test_loader.py b/tests/migrations/test_loader.py
--- a/tests/migrations/test_loader.py
+++ b/tests/migrations/test_loader.py
@@ -508,6 +508,17 @@ def test_ignore_files(self):
migrations = [name for app, name in loader.disk_migrations if app == 'migrations']
self.assertEqu... | Allow migrations directories without __init__.py files
Description
(last modified by Tim Graham)
Background: In python 3 a package with no __init__.py is implicitly a namespace package, so it has no __file__ attribute.
The migrate command currently checks for existence of a __file__ attribute on the migrations... | 2019-03-28T20:49:53Z | 3.1 | ["Migration directories without an __init__.py file are loaded."] | ["test_apply (migrations.test_loader.RecorderTests)", "test_invalid (migrations.test_loader.PycLoaderTests)", "test_valid (migrations.test_loader.PycLoaderTests)", "test_check_consistent_history (migrations.test_loader.LoaderTests)", "test_check_consistent_history_squashed (migrations.test_loader.LoaderTests)", "test_e... | 0668164b4ac93a5be79f5b87fae83c657124d9ab | 15 min - 1 hour | |
django/django | django__django-11149 | e245046bb6e8b32360aa48b8a41fb7050f0fc730 | 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
@@ -2111,46 +2111,50 @@ def get_queryset(self, request):
queryset = queryset.none()
return queryset
+ def _has_any_perms_for_target_model(... | diff --git a/tests/admin_inlines/models.py b/tests/admin_inlines/models.py
--- a/tests/admin_inlines/models.py
+++ b/tests/admin_inlines/models.py
@@ -37,6 +37,9 @@ def __str__(self):
class Book(models.Model):
name = models.CharField(max_length=50)
+ def __str__(self):
+ return self.name
+
class Au... | Admin inlines for auto-created ManyToManyFields are editable if the user only has the view permission
Description
From https://code.djangoproject.com/ticket/8060#comment:34
Replying to Will Gordon:
This seems to have regressed in (at least) 2.1. I have 2 view only permissions. I have a ManyToManyField represented in ... | OK, yes. Fleshing it out I can reproduce this against 2.1.7 with the models and inline provided. A user with only the view permission for both Report and Photo can edit the M2M in the inline. When the M2M is handled as a normal field, rather than an inline, the behaviour is correct. Elevating to a Release Blocker as a ... | 2019-03-30T18:14:35Z | 3.0 | ["test_inline_add_m2m_view_only_perm (admin_inlines.tests.TestInlinePermissions)", "test_inline_change_m2m_view_only_perm (admin_inlines.tests.TestInlinePermissions)"] | ["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... | 419a78300f7cd27611196e1e464d50fd0385ff27 | 15 min - 1 hour |
django/django | django__django-11163 | e6588aa4e793b7f56f4cadbfa155b581e0efc59a | diff --git a/django/forms/models.py b/django/forms/models.py
--- a/django/forms/models.py
+++ b/django/forms/models.py
@@ -83,7 +83,7 @@ def model_to_dict(instance, fields=None, exclude=None):
for f in chain(opts.concrete_fields, opts.private_fields, opts.many_to_many):
if not getattr(f, 'editable', False... | diff --git a/tests/model_forms/tests.py b/tests/model_forms/tests.py
--- a/tests/model_forms/tests.py
+++ b/tests/model_forms/tests.py
@@ -1814,6 +1814,10 @@ class Meta:
bw = BetterWriter.objects.create(name='Joe Better', score=10)
self.assertEqual(sorted(model_to_dict(bw)), ['id', 'name', 'score', ... | model_to_dict() should return an empty dict for an empty list of fields.
Description
Been called as model_to_dict(instance, fields=[]) function should return empty dict, because no fields were requested. But it returns all fields
The problem point is
if fields and f.name not in fields:
which should be
if fields is no... | model_to_dict() is a part of private API. Do you have any real use case for passing empty list to this method?
PR
This method is comfortable to fetch instance fields values without touching ForeignKey fields. List of fields to be fetched is an attr of the class, which can be overridden in subclasses and is empty list ... | 2019-04-02T21:46:42Z | 3.0 | ["test_modelform_subclassed_model (model_forms.tests.ModelOneToOneFieldTests)"] | ["test_modelform_factory_metaclass (model_forms.tests.CustomMetaclassTestCase)", "test_setattr_raises_validation_error_field_specific (model_forms.tests.StrictAssignmentTests)", "test_setattr_raises_validation_error_non_field (model_forms.tests.StrictAssignmentTests)", "test_notrequired_overrides_notblank (model_forms.... | 419a78300f7cd27611196e1e464d50fd0385ff27 | <15 min fix |
django/django | django__django-11179 | 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 | <15 min fix |
django/django | django__django-11276 | 28d5262fa3315690395f04e3619ed554dbaf725b | diff --git a/django/utils/html.py b/django/utils/html.py
--- a/django/utils/html.py
+++ b/django/utils/html.py
@@ -1,5 +1,6 @@
"""HTML utilities suitable for global use."""
+import html
import json
import re
from html.parser import HTMLParser
@@ -24,14 +25,6 @@
simple_url_re = re.compile(r'^https?://\[?\w', re.I... | diff --git a/tests/admin_docs/test_views.py b/tests/admin_docs/test_views.py
--- a/tests/admin_docs/test_views.py
+++ b/tests/admin_docs/test_views.py
@@ -199,7 +199,7 @@ def test_methods_with_arguments_display_arguments_default_value(self):
"""
Methods with keyword arguments should have their argumen... | Use Python stdlib html.escape() to in django.utils.html.escape()
Description
The function django.utils.html.escape() partially duplicates the Python stdlib function html.escape(). We can replace this duplication with wider community developed version.
html.escape() has been available since Python 3.2:
https://docs.p... | 2019-04-24T12:35:05Z | 3.0 | ["test_make_list02 (template_tests.filter_tests.test_make_list.MakeListTests)", "test_password_help_text (auth_tests.test_forms.UserCreationFormTest)", "test_url_split_chars (template_tests.filter_tests.test_urlize.FunctionTests)", "test_wrapping_characters (template_tests.filter_tests.test_urlize.FunctionTests)", "tes... | ["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)", "test_password_whitespace_not_stripped (auth_tests.test_forms.AdminPasswordChangeForm... | 419a78300f7cd27611196e1e464d50fd0385ff27 | 15 min - 1 hour | |
django/django | django__django-11292 | eb16c7260e573ec513d84cb586d96bdf508f3173 | 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
@@ -95,7 +95,7 @@ class DjangoHelpFormatter(HelpFormatter):
"""
show_last = {
'--version', '--verbosity', '--traceback', '--settings', '--pythonpath',... | 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
@@ -253,6 +253,16 @@ def test_disallowed_abbreviated_options(self):
self.assertNoOutput(err)
self.assertEqual(out.strip(), 'Set foo')
+ def test_skip_chec... | Add --skip-checks option to management commands.
Description
Management commands already have skip_checks stealth option. I propose exposing this option on the command line. This would allow users to skip checks when running a command from the command line. Sometimes in a development environment, it is nice to move a... | 2019-04-27T14:23:07Z | 3.0 | ["test_skip_checks (user_commands.tests.CommandRunTests)"] | ["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... | 419a78300f7cd27611196e1e464d50fd0385ff27 | 15 min - 1 hour |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 14