repo stringclasses 8
values | instance_id stringlengths 17 31 | patch stringlengths 400 56.6k | problem_statement stringlengths 120 41k | modules_affected int64 1 22 | py_file_count int64 1.08k 15.7k | py_total_lines int64 396k 2.88M | base_commit stringlengths 40 40 |
|---|---|---|---|---|---|---|---|
django/django | django__django-10213 | 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',... | Add an option to django-admin to always colorize output
Description
With Django management commands, it is currently possible disable colors with the --no-colors flag.
What I'd like to have is basically the other side of the coin: a --force-colors flag that instructs Django to output ANSI color sequences in cases it ... | 2 | 2,882 | 506,544 | a0ef6a0e22038a36c3646ea96f61fdc6d7ab7e5c |
django/django | django__django-10301 | diff --git a/django/db/backends/oracle/operations.py b/django/db/backends/oracle/operations.py
--- a/django/db/backends/oracle/operations.py
+++ b/django/db/backends/oracle/operations.py
@@ -569,7 +569,7 @@ def subtract_temporals(self, internal_type, lhs, rhs):
if internal_type == 'DateField':
lhs... | SQLite functions crashes on NULL values
Description
In [14]: TestModel2.objects.annotate(null=models.Value(None, output_field=models.IntegerField())).values(pow=models.F('null') ** models.F('null')).first()
---------------------------------------------------------------------------
OperationalError Traceback (m... | 4 | 2,882 | 506,544 | 76dfa834e7ceeca97cd8e3cfa86651a955aa3f0c |
django/django | django__django-10531 | diff --git a/django/contrib/admin/models.py b/django/contrib/admin/models.py
--- a/django/contrib/admin/models.py
+++ b/django/contrib/admin/models.py
@@ -114,7 +114,7 @@ def get_change_message(self):
elif 'changed' in sub_message:
sub_message['changed']['fields'] = get_text_list... | Models history doesn't use verbose names
Description
The history for a model object (within the admin section) should show human-readable messages, favoring verbose names over field names. However, this is not currently the case. For example, consider a model with the following class variable:
pub_date = models.DateT... | 2 | 2,882 | 506,544 | 1564e42ad397021093585147875a21dae1a3b3fc |
django/django | django__django-10554 | 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... | 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... | 2 | 2,882 | 506,544 | 14d026cccb144c6877294ba4cd4e03ebf0842498 |
django/django | django__django-10680 | diff --git a/django/db/backends/base/operations.py b/django/db/backends/base/operations.py
--- a/django/db/backends/base/operations.py
+++ b/django/db/backends/base/operations.py
@@ -26,6 +26,9 @@ class BaseDatabaseOperations:
'BigIntegerField': (-9223372036854775808, 9223372036854775807),
'PositiveSm... | Refactor AutoField logic into a mixin, implement checks and validators.
Description
Currently AutoField inherits from Field and BigAutoField from AutoField. In effect they largely redefine IntegerField and BigIntegerField respectively, but add in the auto field "behaviour". As a result they do not perform some of the... | 3 | 2,882 | 506,544 | b10d322c41f66dc7c77c36f90a3532269b25ea93 |
django/django | django__django-10853 | diff --git a/django/db/backends/base/features.py b/django/db/backends/base/features.py
--- a/django/db/backends/base/features.py
+++ b/django/db/backends/base/features.py
@@ -239,6 +239,7 @@ class BaseDatabaseFeatures:
# Does the backend support window expressions (expression OVER (...))?
supports_over_clau... | SQLite (pre 3.25.0) does not support window functions, raises OperationalError
Description
Window functions are supported in SQLite 3.25.0 and newer, but Python 3.6.7 and 3.7.1 only ships with SQLite 3.21.0. Window function syntax is invalid for older versions.
As per the title, window functions therefore aren't supp... | 4 | 2,882 | 506,544 | eefc9550fd3b8011cc12069eb700df09f25cc4d9 |
django/django | django__django-10904 | diff --git a/django/contrib/auth/password_validation.py b/django/contrib/auth/password_validation.py
--- a/django/contrib/auth/password_validation.py
+++ b/django/contrib/auth/password_validation.py
@@ -173,7 +173,7 @@ def __init__(self, password_list_path=DEFAULT_PASSWORD_LIST_PATH):
try:
with gz... | Replace use of OSError aliases with OSError (IOError, EnvironmentError, WindowsError, mmap.error, socket.error, select.error)
Description
Starting with Python 3.3, EnvironmentError, IOError, WindowsError, socket.error, select.error and mmap.error are aliases of OSError. With this in mind, the Django code base can be ... | 18 | 2,882 | 506,544 | 7444f3252757ed4384623e5afd7dcfeef3e0c74e |
django/django | django__django-10910 | 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,9 +69,20 @@ def date_trunc_sql(self, lookup_type, field_name):
else:
return "DATE(%s)" % (field_name)
+ ... | Using database functions with tzinfo=datetime.timezone(datetime.timedelta(...)) results in an incorrect query
Description
I haven’t checked this bug with other databases, but it definitely works improperly with postgres.
Django ORM create incorrect query when I use timezone determined like "timezone(timedelta(hours=s... | 4 | 2,882 | 506,544 | 3dca8738cbbbb5674f795169e5ea25e2002f2d71 |
django/django | django__django-10989 | diff --git a/django/contrib/gis/utils/layermapping.py b/django/contrib/gis/utils/layermapping.py
--- a/django/contrib/gis/utils/layermapping.py
+++ b/django/contrib/gis/utils/layermapping.py
@@ -596,7 +596,7 @@ def _save(feat_range=default_range, num_feat=0, num_saved=0):
# Printing progress informat... | Ellipses in output strings cause crashes on Windows
Description
(last modified by Dan Davis)
By default, Windows terminals start with code page 437, which is roughly equivalent to ASCII. While working on #30178, I discovered that this causes the following traceback:
(mplusmon) λ manage.py runserver
Watchman una... | 13 | 2,882 | 506,544 | f63811f4813f0e0439e140a97eeba18a5017e858 |
django/django | django__django-11030 | diff --git a/django/db/models/aggregates.py b/django/db/models/aggregates.py
--- a/django/db/models/aggregates.py
+++ b/django/db/models/aggregates.py
@@ -64,7 +64,7 @@ def default_alias(self):
return '%s__%s' % (expressions[0].name, self.name.lower())
raise TypeError("Complex expressions require ... | Subquery expressions unnecessarily added to group by
Description
Hi friends,
My Django/SQL skills are not good enough to properly isolate the problem independently of my use case detailed below. I believe the problem is Subqueries being forced in to the group_by clause because they are select expressions. Per the bel... | 5 | 2,882 | 506,544 | 2aaabe2004e1953eb7d7057edcf2fabd37f7394d |
django/django | django__django-11096 | diff --git a/django/contrib/admin/templatetags/admin_list.py b/django/contrib/admin/templatetags/admin_list.py
--- a/django/contrib/admin/templatetags/admin_list.py
+++ b/django/contrib/admin/templatetags/admin_list.py
@@ -128,6 +128,9 @@ def result_headers(cl):
continue
admin_order_fiel... | Support the use of admin_order_field on properties in the admin.
Description
The ModelAdmin class allows to specify properties from the model in list_display.
Normally non-fields cannot be sorted. This can be changed by setting admin_order_field. This doesn't work on properties, while it is possible to do so with sho... | 2 | 2,882 | 506,544 | ea60b7bc7464808e34e3cb0aac04455fdd8545eb |
django/django | django__django-11138 | 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... | 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://... | 4 | 2,882 | 506,544 | c84b91b7603e488f7171fdff8f08368ef3d6b856 |
django/django | django__django-11155 | diff --git a/django/conf/global_settings.py b/django/conf/global_settings.py
--- a/django/conf/global_settings.py
+++ b/django/conf/global_settings.py
@@ -154,6 +154,9 @@ def gettext_noop(s):
LANGUAGE_COOKIE_AGE = None
LANGUAGE_COOKIE_DOMAIN = None
LANGUAGE_COOKIE_PATH = '/'
+LANGUAGE_COOKIE_SECURE = False
+LANGUAGE... | Support setting Secure, HttpOnly, SameSite on the language cookie
Description
I propose to add the following settings, with the following default values:
LANGUAGE_COOKIE_SECURE = False
LANGUAGE_COOKIE_HTTPONLY = False
LANGUAGE_COOKIE_SAMESITE = None
The default values maintain the current behavior.
These settings do ... | 2 | 2,882 | 506,544 | cef3f2d3c64055c9fc1757fd61dba24b557a2add |
django/django | django__django-11281 | diff --git a/django/contrib/admin/models.py b/django/contrib/admin/models.py
--- a/django/contrib/admin/models.py
+++ b/django/contrib/admin/models.py
@@ -73,14 +73,14 @@ def __repr__(self):
def __str__(self):
if self.is_addition():
- return gettext('Added "%(object)s".') % {'object': self.ob... | Improve typography of user facing strings.
Description
Inspired by comment: https://code.djangoproject.com/ticket/30399#comment:2
Prefer:
“” for quotes
’ for contractions
— rather than --
… rather than ...
| 22 | 2,882 | 506,544 | 2b03e8e9e8205ae3a3aa128764277e70b7c30803 |
django/django | django__django-11298 | diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py
--- a/django/db/models/fields/related.py
+++ b/django/db/models/fields/related.py
@@ -1234,18 +1234,6 @@ def _check_relationship_model(self, from_model=None, **kwargs):
to_model_name = to_model._meta.object_name
... | Allow ManyToManyField using a intermediary table to be defined as symmetrical.
Description
Thanks to the work made by Collin Anderson in #9475 I think we can remove the check
"fields.E332 Many-to-many fields with intermediate tables must not be symmetrical." with a little adjustment.
This change was discussed in the... | 2 | 2,882 | 506,544 | a9179ab032cda80801e7f67ef20db5ee60989f21 |
django/django | django__django-11333 | diff --git a/django/urls/base.py b/django/urls/base.py
--- a/django/urls/base.py
+++ b/django/urls/base.py
@@ -7,7 +7,7 @@
from django.utils.translation import override
from .exceptions import NoReverseMatch, Resolver404
-from .resolvers import get_ns_resolver, get_resolver
+from .resolvers import _get_cached_resol... | Optimization: Multiple URLResolvers may be unintentionally be constructed by calls to `django.urls.resolvers.get_resolver`
Description
Multiple URLResolvers may be constructed by django.urls.resolvers.get_resolver if django.urls.base.set_urlconf has not yet been called, resulting in multiple expensive calls to URLRes... | 2 | 2,882 | 506,544 | 55b68de643b5c2d5f0a8ea7587ab3b2966021ccc |
django/django | django__django-11359 | diff --git a/django/contrib/gis/db/models/functions.py b/django/contrib/gis/db/models/functions.py
--- a/django/contrib/gis/db/models/functions.py
+++ b/django/contrib/gis/db/models/functions.py
@@ -101,10 +101,13 @@ class SQLiteDecimalToFloatMixin:
is not acceptable by the GIS functions expecting numeric values.
... | Automatically resolve Value's output_field for stdlib types.
Description
Hi,
I have a model of AModel. AModel has a SearchVectorField named search_vector. I want to update this vector by indexing a string that is not in any other field.
from django.db.models import Value
from django.contrib.postgres.search import Se... | 4 | 2,882 | 506,544 | d08e6f55e3a986a8d4b3a58431d9615c7bc81eaa |
django/django | django__django-11383 | 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
@@ -684,14 +684,19 @@ def save(self, force_insert=False, force_update=False, using=None,
# database to raise an IntegrityError if applicable. If
# constraints ... | Saving parent object after setting on child leads to unexpected data loss
Description
(last modified by Erwin Junge)
When saving a parent object after setting it on a child object and then saving the child object, no error is thrown but the FK relation is saved with a NULL value.
Failing testcase:
# Create pa... | 2 | 2,882 | 506,544 | 9d6f981a66bd2c4188c4a3e08e4f36fc9c4882ef |
django/django | django__django-11389 | diff --git a/django/contrib/sessions/backends/base.py b/django/contrib/sessions/backends/base.py
--- a/django/contrib/sessions/backends/base.py
+++ b/django/contrib/sessions/backends/base.py
@@ -206,6 +206,9 @@ def _get_session(self, no_load=False):
_session = property(_get_session)
+ def get_session_cookie... | Allow SessionStore's to be easily overridden to make dynamic the session cookie age
Description
If I want to make dynamic my SESSION_COOKIE_AGE setting based on certain parameters of the session I need to reimplement in my SessionStore subclasses the following methods:
get_expiry_age
get_expiry_date
just to override ... | 3 | 2,882 | 506,544 | df28ebd6c89d68e781020a6a4e8405c0154e8e40 |
django/django | django__django-11400 | diff --git a/django/contrib/admin/filters.py b/django/contrib/admin/filters.py
--- a/django/contrib/admin/filters.py
+++ b/django/contrib/admin/filters.py
@@ -193,11 +193,17 @@ def has_output(self):
def expected_parameters(self):
return [self.lookup_kwarg, self.lookup_kwarg_isnull]
- def field_choice... | Ordering problem in admin.RelatedFieldListFilter and admin.RelatedOnlyFieldListFilter
Description
RelatedFieldListFilter doesn't fall back to the ordering defined in Model._meta.ordering.
Ordering gets set to an empty tuple in https://github.com/django/django/blob/2.2.1/django/contrib/admin/filters.py#L196 and unle... | 3 | 2,882 | 506,544 | 1f8382d34d54061eddc41df6994e20ee38c60907 |
django/django | django__django-11527 | diff --git a/django/core/management/commands/sqlflush.py b/django/core/management/commands/sqlflush.py
--- a/django/core/management/commands/sqlflush.py
+++ b/django/core/management/commands/sqlflush.py
@@ -19,4 +19,7 @@ def add_arguments(self, parser):
)
def handle(self, **options):
- return '\n... | sqlsequencereset should inform that no sequences found.
Description
This just came up on IRC, because someone was expecting sqlsequencereset to provide resets for the auto-increment values for an SQLite table.
Running python manage.py sqlsequencereset <myapp> provides no output if there are no results returned by con... | 3 | 2,882 | 506,544 | c2f381ef17058e5cfea58ae507983d2e459a2888 |
django/django | django__django-11532 | diff --git a/django/core/mail/message.py b/django/core/mail/message.py
--- a/django/core/mail/message.py
+++ b/django/core/mail/message.py
@@ -16,7 +16,7 @@
from django.conf import settings
from django.core.mail.utils import DNS_NAME
-from django.utils.encoding import force_str
+from django.utils.encoding import fo... | Email messages crash on non-ASCII domain when email encoding is non-unicode.
Description
When the computer hostname is set in unicode (in my case "正宗"), the following test fails: https://github.com/django/django/blob/master/tests/mail/tests.py#L368
Specifically, since the encoding is set to iso-8859-1, Python attemp... | 5 | 2,882 | 506,544 | a5308514fb4bc5086c9a16a8a24a945eeebb073c |
django/django | django__django-11539 | 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
@@ -1567,9 +1567,32 @@ def _check_unique_together(cls):
@classmethod
def _check_indexes(cls):
- """Check the fields of indexes."""
+ """Check the fields and names of i... | Move index name checks from Index.__init__ into system checks.
Description
(last modified by Mariusz Felisiak)
Index names assertions should be moved to system checks to keep code cleaner and more consistent.
| 2 | 2,882 | 506,544 | f197c3dd9130b18397022605c27ffe5755f329d7 |
django/django | django__django-11584 | diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -240,8 +240,15 @@ def __init__(self):
def watch_dir(self, path, glob):
path = Path(path)
- if not path.is_absolute():
- raise ValueError('%s must be... | [FATAL] FileNotFoundError with runserver command inside Docker container
Description
Summary
Trying to run the development server in a container with volume-mounted source is throwing a FileNotFoundError. I've verified that the issue is consistently reproducible with Django==2.2.3 and not present in Django==2.1.4.
Tr... | 2 | 2,882 | 506,544 | fed5e19369f456e41f0768f4fb92602af027a46d |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 4