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
django/django
django__django-11299
6866c91b638de5368c18713fa851bfe56253ea55
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -1338,7 +1338,7 @@ def _add_q(self, q_object, used_aliases, branch_negated=False, if isinstance(child, Node): child_clause, needed_inner = s...
diff --git a/tests/migrations/test_operations.py b/tests/migrations/test_operations.py --- a/tests/migrations/test_operations.py +++ b/tests/migrations/test_operations.py @@ -1898,6 +1898,29 @@ def test_add_constraint_percent_escaping(self): author = Author.objects.create(name='Albert', rebate='10%') ...
CheckConstraint with OR operator generates incorrect SQL on SQLite and Oracle. Description (last modified by Michael Spallino) Django is incorrectly including the fully qualified field name(e.g. “my_table”.”my_field”) in part of the check constraint. This only appears to happen when there is a combination of OR...
Could you confirm this also happens on other backends than SQLite? ​PR The patch changes are looking great. I left a suggestion to simply one the tests assertions to make them easier to parse by a human but they are testing the right thing.
2019-04-28T11:15:08Z
3.0
["test_simplecol_query (queries.test_query.TestQuery)"]
["test_reference_field_by_through_fields (migrations.test_operations.FieldOperationTests)", "test_references_field_by_from_fields (migrations.test_operations.FieldOperationTests)", "test_references_field_by_name (migrations.test_operations.FieldOperationTests)", "test_references_field_by_remote_field_model (migrations....
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
django/django
django__django-11400
1f8382d34d54061eddc41df6994e20ee38c60907
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...
diff --git a/tests/admin_filters/tests.py b/tests/admin_filters/tests.py --- a/tests/admin_filters/tests.py +++ b/tests/admin_filters/tests.py @@ -591,6 +591,22 @@ class BookAdmin(ModelAdmin): expected = [(self.john.pk, 'John Blue'), (self.jack.pk, 'Jack Red')] self.assertEqual(filterspec.lookup_choic...
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...
Sample project illustrating the problem. Navigate to /admin/foo/book and observer the order of Author in the list filters. Screenshot of RelatedOnlyFieldListFilter not ordering items. OK, yes, seems a reasonable suggestion if you'd like to work on it. Hello. We've updated our django recently and faced this bug. For me ...
2019-05-22T11:30:39Z
3.0
["test_get_choices_default_ordering (model_fields.tests.GetChoicesOrderingTests)", "test_get_choices_reverse_related_field_default_ordering (model_fields.tests.GetChoicesOrderingTests)", "RelatedFieldListFilter ordering respects Model.ordering.", "test_relatedfieldlistfilter_reverse_relationships_default_ordering (admi...
["test_choices_and_field_display (model_fields.tests.GetFieldDisplayTests)", "test_empty_iterator_choices (model_fields.tests.GetFieldDisplayTests)", "A translated display value is coerced to str.", "test_iterator_choices (model_fields.tests.GetFieldDisplayTests)", "test_check (model_fields.tests.ChoicesTests)", "test_...
419a78300f7cd27611196e1e464d50fd0385ff27
1-4 hours
django/django
django__django-11451
e065b293878b1e3ea56655aa9d33e87576cd77ff
diff --git a/django/contrib/auth/backends.py b/django/contrib/auth/backends.py --- a/django/contrib/auth/backends.py +++ b/django/contrib/auth/backends.py @@ -39,6 +39,8 @@ class ModelBackend(BaseBackend): def authenticate(self, request, username=None, password=None, **kwargs): if username is None: ...
diff --git a/tests/auth_tests/test_auth_backends.py b/tests/auth_tests/test_auth_backends.py --- a/tests/auth_tests/test_auth_backends.py +++ b/tests/auth_tests/test_auth_backends.py @@ -226,6 +226,19 @@ def test_authentication_timing(self): authenticate(username='no_such_user', password='test') self....
ModelBackend.authenticate() shouldn't make a database query when username is None Description It's easier to explain my issue by adding a comment in the current implementation of ModelBackend.authenticate(): def authenticate(self, request, username=None, password=None, **kwargs): if username is None: username =...
2019-06-08T19:11:42Z
3.0
["test_authentication_without_credentials (auth_tests.test_auth_backends.ModelBackendTest)", "test_custom_perms (auth_tests.test_auth_backends.ModelBackendTest)", "test_authentication_without_credentials (auth_tests.test_auth_backends.CustomPermissionsUserModelBackendTest)", "test_custom_perms (auth_tests.test_auth_bac...
["test_raises_exception (auth_tests.test_auth_backends.NoBackendsTest)", "test_get_all_permissions (auth_tests.test_auth_backends.BaseBackendTest)", "test_get_group_permissions (auth_tests.test_auth_backends.BaseBackendTest)", "test_get_user_permissions (auth_tests.test_auth_backends.BaseBackendTest)", "test_has_perm (...
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
django/django
django__django-11551
7991111af12056ec9a856f35935d273526338c1f
diff --git a/django/contrib/admin/checks.py b/django/contrib/admin/checks.py --- a/django/contrib/admin/checks.py +++ b/django/contrib/admin/checks.py @@ -720,33 +720,33 @@ def _check_list_display_item(self, obj, item, label): return [] elif hasattr(obj, item): return [] - elif...
diff --git a/tests/modeladmin/test_checks.py b/tests/modeladmin/test_checks.py --- a/tests/modeladmin/test_checks.py +++ b/tests/modeladmin/test_checks.py @@ -3,7 +3,7 @@ from django.contrib.admin.options import VERTICAL, ModelAdmin, TabularInline from django.contrib.admin.sites import AdminSite from django.core.che...
admin.E108 is raised on fields accessible only via instance. Description (last modified by ajcsimons) As part of startup django validates the ModelAdmin's list_display list/tuple for correctness (django.admin.contrib.checks._check_list_display). Having upgraded django from 2.07 to 2.2.1 I found that a ModelAdmi...
fix Fix is quite simple but a regression test can be tricky. Hi felixxm, I also just made a ticket #30545 with more details. Working through all the logical combinations I think both the old code and new code have other bugs and I've posted a suggested fix there. Updated description with detail from #30545 I think ther...
2019-07-09T22:28:45Z
3.0
["test_valid_field_accessible_via_instance (modeladmin.test_checks.ListDisplayTests)"]
["test_not_integer (modeladmin.test_checks.ExtraCheckTests)", "test_valid_case (modeladmin.test_checks.ExtraCheckTests)", "test_duplicate_fields_in_fields (modeladmin.test_checks.FieldsCheckTests)", "test_inline (modeladmin.test_checks.FieldsCheckTests)", "test_missing_field (modeladmin.test_checks.FkNameCheckTests)", ...
419a78300f7cd27611196e1e464d50fd0385ff27
15 min - 1 hour
django/django
django__django-11603
f618e033acd37d59b536d6e6126e6c5be18037f6
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 @@ -99,6 +99,7 @@ def _get_repr_options(self): class Avg(FixDurationInputMixin, NumericOutputFieldMixin, Aggregate): function = 'AVG' name = 'Avg' + allow_...
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -388,9 +388,6 @@ def test_count(self): vals = Book.objects.aggregate(Count("rating")) self.assertEqual(vals, {"rating__count": 6}) - vals = Book.objects.ag...
Add DISTINCT support for Avg and Sum aggregates. Description As an extension of #28658, aggregates should be supported for other general aggregates such as Avg and Sum. Before 2.2, these aggregations just ignored the parameter, but now throw an exception. This change would just involve setting these classes as allowi...
​PR
2019-07-28T18:14:23Z
3.0
["test_distinct_on_aggregate (aggregation.tests.AggregateTestCase)", "test_empty_aggregate (aggregation.tests.AggregateTestCase)"]
["test_add_implementation (aggregation.tests.AggregateTestCase)", "test_aggregate_alias (aggregation.tests.AggregateTestCase)", "test_aggregate_annotation (aggregation.tests.AggregateTestCase)", "test_aggregate_in_order_by (aggregation.tests.AggregateTestCase)", "test_aggregate_multi_join (aggregation.tests.AggregateTe...
419a78300f7cd27611196e1e464d50fd0385ff27
<15 min fix
django/django
django__django-11728
05457817647368be4b019314fcc655445a5b4c0c
diff --git a/django/contrib/admindocs/utils.py b/django/contrib/admindocs/utils.py --- a/django/contrib/admindocs/utils.py +++ b/django/contrib/admindocs/utils.py @@ -155,6 +155,8 @@ def replace_named_groups(pattern): Find named groups in `pattern` and replace them with the group name. E.g., 1. ^(?P<a>\w+)/b/...
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 @@ -348,9 +348,13 @@ def test_simplify_regex(self): (r'^a', '/a'), (r'^(?P<a>\w+)/b/(?P<c>\w+)/$', '/<a>/b/<c>/'), (r'^(?P<a>\w+)/...
simplify_regexp() doesn't replace trailing groups. Description replace_named_groups() fails to replace the final named group if the urlpattern passed in is missing a trailing '/'. For example, with input r'entries/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+)' the "related_field" does not get properly replaced....
Here's execution of the example code: (env) django-example$ python demo.py path: entries/(?P<pk>[^/.]+)/relationships/(?P<related_field>\w+) expected: entries/<pk>/relationships/<related_field> got: entries/<pk>/relationships/(?P<related_field>\w+) path_trailing: entries/(?P<pk>[^/.]+)/relationships/(?P<related_field>\...
2019-08-29T17:31:03Z
3.0
["test_simplify_regex (admin_docs.test_views.AdminDocViewFunctionsTests)", "test_app_not_found (admin_docs.test_views.TestModelDetailView)"]
["test_builtin_fields (admin_docs.test_views.TestFieldType)", "test_custom_fields (admin_docs.test_views.TestFieldType)", "test_field_name (admin_docs.test_views.TestFieldType)", "test_descriptions_render_correctly (admin_docs.test_views.TestModelDetailView)", "Model properties are displayed as fields.", "test_method_d...
419a78300f7cd27611196e1e464d50fd0385ff27
15 min - 1 hour
django/django
django__django-11734
999891bd80b3d02dd916731a7a239e1036174885
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -2332,10 +2332,6 @@ def get_db_prep_value(self, value, connection, prepared=False): value = connection.ops.validate_autopk_value(valu...
diff --git a/tests/queries/tests.py b/tests/queries/tests.py --- a/tests/queries/tests.py +++ b/tests/queries/tests.py @@ -6,7 +6,7 @@ from django.core.exceptions import EmptyResultSet, FieldError from django.db import DEFAULT_DB_ALIAS, connection -from django.db.models import Count, F, Q +from django.db.models imp...
OuterRef in exclude() or ~Q() uses wrong model. Description The following test (added to tests/queries/test_qs_combinators) fails when trying to exclude results using OuterRef() def test_exists_exclude(self): # filter() qs = Number.objects.annotate( foo=Exists( Item.objects.filter(tags__category_id=OuterRef('p...
Thanks for the report. ValueError was fixed in 35431298226165986ad07e91f9d3aca721ff38ec. Provided test fails on master with django.db.utils.ProgrammingError: missing FROM-clause entry for table "V0" LINE 1: ...(U1."tag_id" = U2."id") WHERE U2."category_id" = ("V0"."id")... It looks that OuterRef resolves to "V0"."id" i...
2019-09-01T18:46:50Z
3.0
["test_subquery_exclude_outerref (queries.tests.ExcludeTests)"]
["test_ticket8597 (queries.tests.ComparisonTests)", "#13227 -- If a queryset is already evaluated, it can still be used as a query arg", "test_no_fields_cloning (queries.tests.CloneTests)", "test_no_model_options_cloning (queries.tests.CloneTests)", "test_exists (queries.tests.ExistsSql)", "test_ticket_18414 (queries.t...
419a78300f7cd27611196e1e464d50fd0385ff27
15 min - 1 hour
django/django
django__django-11790
b1d6b35e146aea83b171c1b921178bbaae2795ed
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 @@ -191,7 +191,9 @@ def __init__(self, request=None, *args, **kwargs): # Set the max length and label for the "username" field. self.username_field = UserMod...
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 @@ -423,6 +423,7 @@ def test_username_field_max_length_matches_user_model(self): CustomEmailField.objects.create_user(**data) form = AuthenticationForm...
AuthenticationForm's username field doesn't set maxlength HTML attribute. Description AuthenticationForm's username field doesn't render with maxlength HTML attribute anymore. Regression introduced in #27515 and 5ceaf14686ce626404afb6a5fbd3d8286410bf13. ​https://groups.google.com/forum/?utm_source=digest&utm_medium=e...
Regression test.
2019-09-17T14:33:44Z
3.1
["test_username_field_max_length_defaults_to_254 (auth_tests.test_forms.AuthenticationFormTest)", "test_username_field_max_length_matches_user_model (auth_tests.test_forms.AuthenticationFormTest)"]
["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...
0668164b4ac93a5be79f5b87fae83c657124d9ab
15 min - 1 hour
django/django
django__django-11815
e02f67ef2d03d48128e7a118bf75f0418e24e8ac
diff --git a/django/db/migrations/serializer.py b/django/db/migrations/serializer.py --- a/django/db/migrations/serializer.py +++ b/django/db/migrations/serializer.py @@ -120,9 +120,10 @@ class EnumSerializer(BaseSerializer): def serialize(self): enum_class = self.value.__class__ module = enum_cl...
diff --git a/tests/migrations/test_writer.py b/tests/migrations/test_writer.py --- a/tests/migrations/test_writer.py +++ b/tests/migrations/test_writer.py @@ -257,6 +257,10 @@ class TextEnum(enum.Enum): A = 'a-value' B = 'value-b' + class TextTranslatedEnum(enum.Enum): + A ...
Migrations uses value of enum object instead of its name. Description (last modified by oasl) When using Enum object as a default value for a CharField, the generated migration file uses the value of the Enum object instead of the its name. This causes a problem when using Django translation on the value of the...
Thanks for this report, however I'm not sure how translated values can brake migrations. Can you provide a sample project to reproduce this issue? Migrations with translatable strings works fine for me: >>> class TextEnum(enum.Enum): ... C = _('translatable value') ... >>> TextEnum(_('translatable value')) <TextEnum.C:...
2019-09-24T21:45:36Z
3.1
["test_serialize_class_based_validators (migrations.test_writer.WriterTests)", "test_serialize_enums (migrations.test_writer.WriterTests)"]
["test_args_kwargs_signature (migrations.test_writer.OperationWriterTests)", "test_args_signature (migrations.test_writer.OperationWriterTests)", "test_empty_signature (migrations.test_writer.OperationWriterTests)", "test_expand_args_signature (migrations.test_writer.OperationWriterTests)", "test_kwargs_signature (migr...
0668164b4ac93a5be79f5b87fae83c657124d9ab
15 min - 1 hour
django/django
django__django-11848
f0adf3b9b7a19cdee05368ff0c0c2d087f011180
diff --git a/django/utils/http.py b/django/utils/http.py --- a/django/utils/http.py +++ b/django/utils/http.py @@ -176,10 +176,14 @@ def parse_http_date(date): try: year = int(m.group('year')) if year < 100: - if year < 70: - year += 2000 + current_year = date...
diff --git a/tests/utils_tests/test_http.py b/tests/utils_tests/test_http.py --- a/tests/utils_tests/test_http.py +++ b/tests/utils_tests/test_http.py @@ -1,5 +1,6 @@ import unittest from datetime import datetime +from unittest import mock from django.test import SimpleTestCase, ignore_warnings from django.utils....
django.utils.http.parse_http_date two digit year check is incorrect Description (last modified by Ad Timmering) RFC 850 does not mention this, but in RFC 7231 (and there's something similar in RFC 2822), there's the following quote: Recipients of a timestamp value in rfc850-date format, which uses a two-digit y...
Accepted, however I don't think your patch is correct. The check should be relative to the current year, if I read the RFC quote correctly. Created a pull request: Created a pull request: ​https://github.com/django/django/pull/9214 Still some suggested edits on the PR. I added regression test that fails with old code (...
2019-09-28T04:28:22Z
3.1
["test_parsing_rfc850 (utils_tests.test_http.HttpDateProcessingTests)", "test_parsing_year_less_than_70 (utils_tests.test_http.HttpDateProcessingTests)"]
["test_input_too_large (utils_tests.test_http.Base36IntTests)", "test_invalid_literal (utils_tests.test_http.Base36IntTests)", "test_negative_input (utils_tests.test_http.Base36IntTests)", "test_roundtrip (utils_tests.test_http.Base36IntTests)", "test_to_base36_errors (utils_tests.test_http.Base36IntTests)", "test_to_i...
0668164b4ac93a5be79f5b87fae83c657124d9ab
15 min - 1 hour
django/django
django__django-11999
84633905273fc916e3d17883810d9969c03f73c2
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -763,8 +763,12 @@ def contribute_to_class(self, cls, name, private_only=False): if not getattr(cls, self.attname, None): ...
diff --git a/tests/model_fields/tests.py b/tests/model_fields/tests.py --- a/tests/model_fields/tests.py +++ b/tests/model_fields/tests.py @@ -168,6 +168,16 @@ def test_get_FIELD_display_translated(self): self.assertIsInstance(val, str) self.assertEqual(val, 'translated') + def test_overriding_FI...
Cannot override get_FOO_display() in Django 2.2+. Description I cannot override the get_FIELD_display function on models since version 2.2. It works in version 2.1. Example: class FooBar(models.Model): foo_bar = models.CharField(_("foo"), choices=[(1, 'foo'), (2, 'bar')]) def __str__(self): return self.get_foo_ba...
Thanks for this report. Regression in a68ea231012434b522ce45c513d84add516afa60. Reproduced at 54a7b021125d23a248e70ba17bf8b10bc8619234. OK, I have a lead on this. Not at all happy about how it looks at first pass, but I'll a proof of concept PR together for it tomorrow AM. I don't think it should be marked as blocker s...
2019-10-31T10:39:18Z
3.1
["test_overriding_FIELD_display (model_fields.tests.GetFieldDisplayTests)"]
["test_blank_in_choices (model_fields.tests.GetChoicesTests)", "test_blank_in_grouped_choices (model_fields.tests.GetChoicesTests)", "test_empty_choices (model_fields.tests.GetChoicesTests)", "test_lazy_strings_not_evaluated (model_fields.tests.GetChoicesTests)", "test_check (model_fields.tests.ChoicesTests)", "test_ch...
0668164b4ac93a5be79f5b87fae83c657124d9ab
15 min - 1 hour
django/django
django__django-12125
89d41cba392b759732ba9f1db4ff29ed47da6a56
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 @@ -269,7 +269,7 @@ def serialize(self): if module == builtins.__name__: return self.value.__name__, set() els...
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 @@ -26,6 +26,11 @@ from .models import FoodManager, FoodQuerySet +class DeconstructibleInstances: + def deconstruct(self): + return ('DeconstructibleI...
makemigrations produces incorrect path for inner classes Description When you define a subclass from django.db.models.Field as an inner class of some other class, and use this field inside a django.db.models.Model class, then when you run manage.py makemigrations, a migrations file is created which refers to the inne...
This should be possible to do by relying on __qualname__ (instead of __name__) now that master is Python 3 only. ​PR I think we should focus on using __qualname__ during migration serialization as well instead of simply solving the field subclasses case. In fb0f987: Fixed #27914 -- Added support for nested classes in F...
2019-11-22T12:55:45Z
3.1
["test_serialize_nested_class (migrations.test_writer.WriterTests)", "test_serialize_numbers (migrations.test_writer.WriterTests)"]
["test_args_kwargs_signature (migrations.test_writer.OperationWriterTests)", "test_args_signature (migrations.test_writer.OperationWriterTests)", "test_empty_signature (migrations.test_writer.OperationWriterTests)", "test_expand_args_signature (migrations.test_writer.OperationWriterTests)", "test_kwargs_signature (migr...
0668164b4ac93a5be79f5b87fae83c657124d9ab
<15 min fix
django/django
django__django-12143
5573a54d409bb98b5c5acdb308310bed02d392c2
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 @@ -1631,7 +1631,9 @@ def change_view(self, request, object_id, form_url='', extra_context=None): def _get_edited_object_pks(self, request, prefix): ...
diff --git a/tests/admin_changelist/tests.py b/tests/admin_changelist/tests.py --- a/tests/admin_changelist/tests.py +++ b/tests/admin_changelist/tests.py @@ -844,6 +844,26 @@ def test_get_list_editable_queryset(self): queryset = m._get_list_editable_queryset(request, prefix='form') self.assertEqual(q...
Possible data loss in admin changeform view when using regex special characters in formset prefix Description (last modified by Baptiste Mispelon) While browsing the code in admin/options.py [1] (working on an unrelated ticket), I came across that line: pk_pattern = re.compile(r'{}-\d+-{}$'.format(prefix, self....
2019-11-25T14:38:30Z
3.1
["test_get_list_editable_queryset_with_regex_chars_in_prefix (admin_changelist.tests.ChangeListTests)"]
["test_custom_user_pk_not_named_id (admin_changelist.tests.GetAdminLogTests)", "test_missing_args (admin_changelist.tests.GetAdminLogTests)", "{% get_admin_log %} works without specifying a user.", "test_non_integer_limit (admin_changelist.tests.GetAdminLogTests)", "test_without_as (admin_changelist.tests.GetAdminLogTe...
0668164b4ac93a5be79f5b87fae83c657124d9ab
15 min - 1 hour
django/django
django__django-12276
53d8646f799de7f92ab9defe9dc56c6125448102
diff --git a/django/forms/widgets.py b/django/forms/widgets.py --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -387,6 +387,9 @@ def value_from_datadict(self, data, files, name): def value_omitted_from_data(self, data, files, name): return name not in files + def use_required_attribute(...
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -8,11 +8,11 @@ from django.core.validators import MaxValueValidator, RegexValidator from django.forms import ( BooleanField, CharFi...
FileInput shouldn't display required attribute when initial data exists. Description (last modified by thenewguy) I think that ClearableFileInput.use_required_attribute() (​https://github.com/django/django/blob/e703b93a656b78b9b444bb3a9980e305ed002a70/django/forms/widgets.py#L454) should be moved to FileInput.u...
This might explain better: from django import forms from django.core.files.base import ContentFile from django.test import SimpleTestCase class FileForm(forms.Form): file = forms.FileField(widget=forms.FileInput) class FileInputRenderTest(SimpleTestCase): def test_file_input(self): form = FileForm() field = form['file'...
2020-01-05T08:04:40Z
3.1
["test_use_required_attribute (forms_tests.widget_tests.test_fileinput.FileInputTest)", "test_filefield_with_fileinput_required (forms_tests.tests.test_forms.FormsTestCase)"]
["test_attribute_class (forms_tests.tests.test_forms.RendererTests)", "test_attribute_instance (forms_tests.tests.test_forms.RendererTests)", "test_attribute_override (forms_tests.tests.test_forms.RendererTests)", "test_default (forms_tests.tests.test_forms.RendererTests)", "test_kwarg_class (forms_tests.tests.test_for...
0668164b4ac93a5be79f5b87fae83c657124d9ab
<15 min fix
django/django
django__django-12325
29c126bb349526b5f1cd78facbe9f25906f18563
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 @@ -202,7 +202,7 @@ def __new__(cls, name, bases, attrs, **kwargs): continue # Locate OneToOneField instances. for field in base._meta.local_fields: -...
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 @@ -3,7 +3,6 @@ from django.conf import settings from django.core.checks import Error, Warning from django.core.checks.mod...
pk setup for MTI to parent get confused by multiple OneToOne references. Description class Document(models.Model): pass class Picking(Document): document_ptr = models.OneToOneField(Document, on_delete=models.CASCADE, parent_link=True, related_name='+') origin = models.OneToOneField(Document, related_name='picking'...
That seems to be a bug, managed to reproduce. Does the error go away if you add primary_key=True to document_ptr like I assume you wanted to do? This makes me realized that the ​MTI documentation is not completely correcy, ​the automatically added `place_ptr` field end up with `primary_key=True`. Not sure why we're not...
2020-01-15T14:02:25Z
3.1
["test_clash_parent_link (invalid_models_tests.test_relative_fields.ComplexClashTests)", "test_onetoone_with_parent_model (invalid_models_tests.test_models.OtherModelTests)"]
["test_check_constraints (invalid_models_tests.test_models.ConstraintsTests)", "test_check_constraints_required_db_features (invalid_models_tests.test_models.ConstraintsTests)", "test_accessor_clash (invalid_models_tests.test_relative_fields.SelfReferentialFKClashTests)", "test_clash_under_explicit_related_name (invali...
0668164b4ac93a5be79f5b87fae83c657124d9ab
1-4 hours
django/django
django__django-12663
fa5e7e46d875d4143510944f19d79df7b1739bab
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -233,7 +233,8 @@ def __init__(self, model, where=WhereNode, alias_cols=True): @property def output_field(self): if len(self.select) == 1: - ...
diff --git a/tests/expressions/models.py b/tests/expressions/models.py --- a/tests/expressions/models.py +++ b/tests/expressions/models.py @@ -6,10 +6,15 @@ from django.db import models +class Manager(models.Model): + name = models.CharField(max_length=50) + + class Employee(models.Model): firstname = mod...
Using SimpleLazyObject with a nested subquery annotation fails. Description (last modified by Jordan Ephron) Prior to 35431298226165986ad07e91f9d3aca721ff38ec it was possible to use a SimpleLazyObject in a queryset as demonstrated below. This new behavior appears to be a regression. Models from django.contrib.a...
I agree that this behavior was changed in 35431298226165986ad07e91f9d3aca721ff38ec, but you can easily create a test with SimpleLazyObject() (which is not a public API) and Subquery() that always fails with TypeError, e.g. def test_subquery_filter_by_lazy(self): test_user = SimpleLazyObject(lambda: get_user_model().obj...
2020-04-04T18:58:49Z
3.1
["test_subquery_filter_by_lazy (expressions.tests.BasicExpressionsTests)"]
["test_and (expressions.tests.CombinableTests)", "test_negation (expressions.tests.CombinableTests)", "test_or (expressions.tests.CombinableTests)", "test_reversed_and (expressions.tests.CombinableTests)", "test_reversed_or (expressions.tests.CombinableTests)", "test_deconstruct (expressions.tests.FTests)", "test_deepc...
0668164b4ac93a5be79f5b87fae83c657124d9ab
15 min - 1 hour
django/django
django__django-12713
5b884d45ac5b76234eca614d90c83b347294c332
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 @@ -249,17 +249,25 @@ def formfield_for_manytomany(self, db_field, request, **kwargs): return None db = kwargs.get('using') - autocomp...
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -14,7 +14,9 @@ from django.contrib.auth.models import User from django.core.files.storage import default_storage from django.core.files.uploadedfile import SimpleUploadedF...
Allow overridding widget in formfield_for_manytomany(). Description (last modified by Mariusz Felisiak) It does not work when I set widget param to function formfield_for_manytomany(). This is different from the formfield_for_foreignkey() function.
2020-04-13T23:57:12Z
3.1
["test_formfield_overrides_m2m_filter_widget (admin_widgets.tests.AdminFormfieldForDBFieldTests)"]
["test_CharField (admin_widgets.tests.AdminFormfieldForDBFieldTests)", "test_DateField (admin_widgets.tests.AdminFormfieldForDBFieldTests)", "test_DateTimeField (admin_widgets.tests.AdminFormfieldForDBFieldTests)", "test_EmailField (admin_widgets.tests.AdminFormfieldForDBFieldTests)", "test_FileField (admin_widgets.tes...
0668164b4ac93a5be79f5b87fae83c657124d9ab
15 min - 1 hour
django/django
django__django-12774
67f9d076cfc1858b94f9ed6d1a5ce2327dcc8d0d
diff --git a/django/db/models/query.py b/django/db/models/query.py --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -689,7 +689,17 @@ def in_bulk(self, id_list=None, *, field_name='pk'): """ assert not self.query.is_sliced, \ "Cannot use 'limit' or 'offset' with in_bulk"...
diff --git a/tests/lookup/models.py b/tests/lookup/models.py --- a/tests/lookup/models.py +++ b/tests/lookup/models.py @@ -67,6 +67,11 @@ class Season(models.Model): gt = models.IntegerField(null=True, blank=True) nulled_text_field = NulledTextField(null=True) + class Meta: + constraints = [ + ...
Allow QuerySet.in_bulk() for fields with total UniqueConstraints. Description If a field is unique by UniqueConstraint instead of unique=True running in_bulk() on that field will fail. Consider: class Article(models.Model): slug = models.CharField(max_length=255) class Meta: constraints = [ models.UniqueCons...
2020-04-22T11:02:30Z
3.1
["test_in_bulk_meta_constraint (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
15 min - 1 hour
django/django
django__django-13012
22a59c01c00cf9fbefaee0e8e67fab82bbaf1fd2
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 @@ -863,6 +863,9 @@ def set_source_expressions(self, exprs): def get_source_expressions(self): return [self.expression] + def get_group_by_cols(se...
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -1828,3 +1828,13 @@ def test_reversed_and(self): def test_reversed_or(self): with self.assertRaisesMessage(NotImplementedError, self.bitwise_msg): object()...
Constant expressions of an ExpressionWrapper object are incorrectly placed at the GROUP BY clause Description I have a function that expects an arbitrary Query expression and constructs a query on a Postgres db def execQuery(expr): expr = ExpressionWrapper(expr, output_field=IntegerField()) return Model.objects....
Can you confirm the following patch against master resolves your issue? diff --git a/django/db/models/expressions.py b/django/db/models/expressions.py index c1a76584f0..6bd1471692 100644 --- a/django/db/models/expressions.py +++ b/django/db/models/expressions.py @@ -863,6 +863,9 @@ class ExpressionWrapper(Expression): ...
2020-06-02T21:19:37Z
3.2
["test_empty_group_by (expressions.tests.ExpressionWrapperTests)", "test_non_empty_group_by (expressions.tests.ExpressionWrapperTests)"]
["test_aggregates (expressions.tests.ReprTests)", "test_distinct_aggregates (expressions.tests.ReprTests)", "test_expressions (expressions.tests.ReprTests)", "test_filtered_aggregates (expressions.tests.ReprTests)", "test_functions (expressions.tests.ReprTests)", "test_deconstruct (expressions.tests.FTests)", "test_dee...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
15 min - 1 hour
django/django
django__django-13033
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
15 min - 1 hour
django/django
django__django-13112
09914ccf688974e068941f55412b930729bafa06
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 @@ -582,7 +582,11 @@ def deconstruct(self): if self.remote_field.parent_link: kwargs['parent_link'] = self.remote_field.parent_link...
diff --git a/tests/migrations/test_state.py b/tests/migrations/test_state.py --- a/tests/migrations/test_state.py +++ b/tests/migrations/test_state.py @@ -867,6 +867,34 @@ class Meta: with self.assertRaisesMessage(ValueError, msg): project_state.apps + def test_reference_mixed_case_app_label(...
makemigrations crashes for ForeignKey with mixed-case app name. Description When i run "python3 manage.py migrate" on Django 3.1b1 shows me that error (Please, note that the code works well in 3.0) ValueError: The field DJ_RegLogin.Content.category was declared with a lazy reference to 'dj_reglogin.category', but app...
Thanks for the report. Regression in 9e1b6b8a66af4c2197e5b1b41eb9dbb36e4f6502. Reproduced at fbe82f82555bc25dccb476c749ca062f0b522be3. Potential fix: diff --git a/django/db/models/fields/related.py b/django/db/models/fields/related.py index d517d7269b..894d931d50 100644 --- a/django/db/models/fields/related.py +++ b/dj...
2020-06-26T04:51:38Z
3.2
["test_reference_mixed_case_app_label (migrations.test_state.StateTests)"]
["test_abstract_model_children_inherit_indexes (migrations.test_state.ModelStateTests)", "test_bound_field_sanity_check (migrations.test_state.ModelStateTests)", "test_create_swappable (migrations.test_state.ModelStateTests)", "test_create_swappable_from_abstract (migrations.test_state.ModelStateTests)", "test_custom_m...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
<15 min fix
django/django
django__django-13121
ec5aa2161d8015a3fe57dcbbfe14200cd18f0a16
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 @@ -99,12 +99,6 @@ def date_extract_sql(self, lookup_type, field_name): """ raise NotImplementedError('subclasses of BaseDa...
diff --git a/tests/backends/base/test_operations.py b/tests/backends/base/test_operations.py --- a/tests/backends/base/test_operations.py +++ b/tests/backends/base/test_operations.py @@ -93,10 +93,6 @@ def test_time_extract_sql(self): with self.assertRaisesMessage(NotImplementedError, self.may_require_msg % 'd...
durations-only expressions doesn't work on SQLite and MySQL Description class Experiment(models.Model): estimated_time = models.DurationField() list(Experiment.objects.annotate(duration=F('estimated_time') + datime.timedelta(1))) Traceback (most recent call last): File "/home/sergey/dev/django/tests/expressions/tes...
​PR There are test failures on the PR. ​PR
2020-06-29T09:04:15Z
3.2
["test_duration_expressions (expressions.tests.FTimeDeltaTests)"]
["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_empty_group_by (expressions.tests.ExpressionWrapperTests)", "test_non_empty_group_by (expr...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
15 min - 1 hour
django/django
django__django-13128
2d67222472f80f251607ae1b720527afceba06ad
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 @@ -443,23 +443,6 @@ def set_source_expressions(self, exprs): self.lhs, self.rhs = exprs def as_sql(self, compiler, connection): - try: - ...
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -1493,9 +1493,7 @@ def test_duration_expressions(self): @skipUnlessDBFeature('supports_temporal_subtraction') def test_date_subtraction(self): queryset = Experimen...
make temporal subtraction work without ExpressionWrapper Description class Experiment(models.Model): start = models.DateTimeField() end = models.DateTimeField() Experiment.objects.annotate( delta=F('end') - F('start') + Value(datetime.timedelta(), output_field=DurationField()) ) This gives: django.core.exceptions....
2020-06-30T18:06:56Z
3.2
["test_date_case_subtraction (expressions.tests.FTimeDeltaTests)", "test_date_subquery_subtraction (expressions.tests.FTimeDeltaTests)", "test_date_subtraction (expressions.tests.FTimeDeltaTests)", "test_datetime_subquery_subtraction (expressions.tests.FTimeDeltaTests)", "test_datetime_subtraction_microseconds (express...
["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...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
1-4 hours
django/django
django__django-13195
156a2138db20abc89933121e4ff2ee2ce56a173a
diff --git a/django/contrib/messages/storage/cookie.py b/django/contrib/messages/storage/cookie.py --- a/django/contrib/messages/storage/cookie.py +++ b/django/contrib/messages/storage/cookie.py @@ -92,7 +92,11 @@ def _update_cookie(self, encoded_data, response): samesite=settings.SESSION_COOKIE_SAMESI...
diff --git a/tests/messages_tests/test_cookie.py b/tests/messages_tests/test_cookie.py --- a/tests/messages_tests/test_cookie.py +++ b/tests/messages_tests/test_cookie.py @@ -1,5 +1,6 @@ import json +from django.conf import settings from django.contrib.messages import constants from django.contrib.messages.storage...
HttpResponse.delete_cookie() should preserve cookie's samesite. Description We noticed we were getting this warning message from Firefox: 'Cookie “messages” will be soon rejected because it has the “sameSite” attribute set to “none” or an invalid value, without the “secure” attribute. To know more about the “sameSite...
Thanks for this report, IMO we should add the samesite argument to delete_cookie() and preserve it for deleted cookies (see related #30862).
2020-07-15T11:00:07Z
3.2
["test_delete_cookie_samesite (responses.test_cookie.DeleteCookieTests)", "test_delete_cookie_secure_samesite_none (responses.test_cookie.DeleteCookieTests)", "test_session_delete_on_end (sessions_tests.tests.SessionMiddlewareTests)", "test_session_delete_on_end_with_custom_domain_and_path (sessions_tests.tests.Session...
["test_default (responses.test_cookie.DeleteCookieTests)", "test_delete_cookie_secure_prefix (responses.test_cookie.DeleteCookieTests)", "set_cookie() accepts an aware datetime as expiration time.", "Setting a cookie after deletion clears the expiry date.", "Cookie will expire when a distant expiration time is provided...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
15 min - 1 hour
django/django
django__django-13279
6e9c5ee88fc948e05b4a7d9f82a8861ed2b0343d
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 @@ -108,6 +108,9 @@ def _hash(self, value): def encode(self, session_dict): "Return the given session dictionary ...
diff --git a/tests/sessions_tests/tests.py b/tests/sessions_tests/tests.py --- a/tests/sessions_tests/tests.py +++ b/tests/sessions_tests/tests.py @@ -31,9 +31,11 @@ from django.core.exceptions import ImproperlyConfigured, SuspiciousOperation from django.http import HttpResponse from django.test import ( - Reques...
Session data cannot be decoded during the transition to Django 3.1. Description In d4fff711d4c97356bd6ba1273d2a5e349326eb5f (#31274) we've changed format for session data, that's why setting DEFAULT_HASHING_ALGORITHM to 'sha1' is not enough to support running multiple instances of the same project during the transiti...
2020-08-07T05:15:16Z
3.2
["test_default_hashing_algorith_legacy_decode (sessions_tests.tests.CookieSessionTests)", "test_default_hashing_algorith_legacy_decode (sessions_tests.tests.CacheSessionTests)", "test_default_hashing_algorith_legacy_decode (sessions_tests.tests.FileSessionTests)", "test_default_hashing_algorith_legacy_decode (sessions_...
["test_clear (sessions_tests.tests.CookieSessionTests)", "test_custom_expiry_datetime (sessions_tests.tests.CookieSessionTests)", "test_custom_expiry_reset (sessions_tests.tests.CookieSessionTests)", "test_custom_expiry_seconds (sessions_tests.tests.CookieSessionTests)", "test_custom_expiry_timedelta (sessions_tests.te...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
15 min - 1 hour
django/django
django__django-13344
e39e727ded673e74016b5d3658d23cbe20234d11
diff --git a/django/contrib/sessions/middleware.py b/django/contrib/sessions/middleware.py --- a/django/contrib/sessions/middleware.py +++ b/django/contrib/sessions/middleware.py @@ -13,9 +13,7 @@ class SessionMiddleware(MiddlewareMixin): # RemovedInDjango40Warning: when the deprecation ends, replace with: # ...
diff --git a/tests/cache/tests.py b/tests/cache/tests.py --- a/tests/cache/tests.py +++ b/tests/cache/tests.py @@ -2083,6 +2083,7 @@ def test_constructor(self): self.assertEqual(middleware.cache_timeout, 30) self.assertEqual(middleware.key_prefix, 'middlewareprefix') self.assertEqual(middlewa...
Coroutine passed to the first middleware's process_response() instead of HttpResponse. Description Like the title says, using ASGI (+ uvicorn in my case), the first middleware (according to the list in settings.py) receives a coroutine as its response parameter, while all other middlewares down the line receive a dja...
Tentatively accepted for investigation. It's not about the first middleware because if you have only one it gets HttpResponse, but if you have at least two then then the first in a chain gets coroutine. Andrew, Can you take a look? I think it's a bug in SecurityMiddleware : its __init__ does not call super().__init__()...
2020-08-24T20:50:35Z
3.2
["test_coroutine (deprecation.test_middleware_mixin.MiddlewareMixinTests)", "test_deprecation (deprecation.test_middleware_mixin.MiddlewareMixinTests)"]
["Nonexistent cache keys return as None/default.", "set_many() returns an empty list when all keys are inserted.", "test_createcachetable_observes_database_router (cache.tests.CreateCacheTableForDBCacheTests)", "test_per_thread (cache.tests.CacheHandlerTest)", "test_same_instance (cache.tests.CacheHandlerTest)", "If No...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
1-4 hours
django/django
django__django-13406
84609b3205905097d7d3038d32e6101f012c0619
diff --git a/django/db/models/query.py b/django/db/models/query.py --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -210,6 +210,8 @@ def query(self): @query.setter def query(self, value): + if value.values_select: + self._iterable_class = ValuesIterable self._que...
diff --git a/tests/queryset_pickle/tests.py b/tests/queryset_pickle/tests.py --- a/tests/queryset_pickle/tests.py +++ b/tests/queryset_pickle/tests.py @@ -11,7 +11,7 @@ class PickleabilityTestCase(TestCase): @classmethod def setUpTestData(cls): - Happening.objects.create() # make sure the defaults ar...
Queryset with values()/values_list() crashes when recreated from a pickled query. Description I am pickling query objects (queryset.query) for later re-evaluation as per ​https://docs.djangoproject.com/en/2.2/ref/models/querysets/#pickling-querysets. However, when I tried to rerun a query that combines values and ann...
It seems that I have found the culprit. The queryset has an attribute _iterable_class, which in case of a .objects.all() type of query is ModelIterable, but when .values() is used, it should be ValuesIterable. Unfortunately, this is an attribute of the queryset, not of the query and thus it does not get pickled and unp...
2020-09-10T12:38:11Z
3.2
["test_annotation_values (queryset_pickle.tests.PickleabilityTestCase)", "test_annotation_values_list (queryset_pickle.tests.PickleabilityTestCase)", "test_annotation_with_callable_default (queryset_pickle.tests.PickleabilityTestCase)"]
["test_in_lookup_query_evaluation (queryset_pickle.tests.InLookupTests)", "test_in_lookup_queryset_evaluation (queryset_pickle.tests.InLookupTests)", "test_datetime_callable_default_all (queryset_pickle.tests.PickleabilityTestCase)", "test_datetime_callable_default_filter (queryset_pickle.tests.PickleabilityTestCase)",...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
<15 min fix
django/django
django__django-13410
580a4341cb0b4cbfc215a70afc004875a7e815f4
diff --git a/django/core/files/locks.py b/django/core/files/locks.py --- a/django/core/files/locks.py +++ b/django/core/files/locks.py @@ -107,9 +107,12 @@ def unlock(f): return True else: def lock(f, flags): - ret = fcntl.flock(_fd(f), flags) - return ret == 0 + ...
diff --git a/tests/files/tests.py b/tests/files/tests.py --- a/tests/files/tests.py +++ b/tests/files/tests.py @@ -8,7 +8,7 @@ from pathlib import Path from unittest import mock -from django.core.files import File +from django.core.files import File, locks from django.core.files.base import ContentFile from djang...
Bug in posix implementation of django/core/files/locks.py Description The posix version of locks (the version which supports import fcntl) has a bug. The code attempts to return True to indicate success or failure acquiring a lock, but instead it always returns False. The reason is that cpython fcntl module returns N...
Thanks for the ticket. Would you like to prepare a pull request? (tests are also required).
2020-09-11T09:58:41Z
3.2
["test_exclusive_lock (files.tests.FileTests)", "test_shared_lock (files.tests.FileTests)"]
["test_open_resets_file_to_start_and_returns_context_manager (files.tests.InMemoryUploadedFileTests)", "test_content_file_custom_name (files.tests.ContentFileTestCase)", "test_content_file_default_name (files.tests.ContentFileTestCase)", "test_content_file_input_type (files.tests.ContentFileTestCase)", "test_open_reset...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
<15 min fix
django/django
django__django-13512
b79088306513d5ed76d31ac40ab3c15f858946ea
diff --git a/django/contrib/admin/utils.py b/django/contrib/admin/utils.py --- a/django/contrib/admin/utils.py +++ b/django/contrib/admin/utils.py @@ -1,5 +1,6 @@ import datetime import decimal +import json from collections import defaultdict from django.core.exceptions import FieldDoesNotExist @@ -400,7 +401,7 @...
diff --git a/tests/admin_utils/tests.py b/tests/admin_utils/tests.py --- a/tests/admin_utils/tests.py +++ b/tests/admin_utils/tests.py @@ -186,6 +186,7 @@ def test_json_display_for_field(self): ({'a': {'b': 'c'}}, '{"a": {"b": "c"}}'), (['a', 'b'], '["a", "b"]'), ('a', '"a"'), + ...
Admin doesn't display properly unicode chars in JSONFields. Description (last modified by ZhaoQi99) >>> import json >>> print json.dumps('中国') "\u4e2d\u56fd" json.dumps use ASCII encoding by default when serializing Chinese. So when we edit a JsonField which contains Chinese character in Django admin,it will ap...
As far as I'm aware, we cannot use ensure_ascii=False by default because it requires utf8mb4 encoding on MySQL, see #18392. It looks that you can use a custom encoder/decoder to make it works without changes in Django. Replying to felixxm: As far as I'm aware, we cannot use ensure_ascii=False by default because it requ...
2020-10-08T13:52:57Z
3.2
["test_prepare_value (forms_tests.field_tests.test_jsonfield.JSONFieldTest)", "test_json_display_for_field (admin_utils.tests.UtilsTests)", "test_label_for_field (admin_utils.tests.UtilsTests)"]
["test_cyclic (admin_utils.tests.NestedObjectsTests)", "test_non_added_parent (admin_utils.tests.NestedObjectsTests)", "test_on_delete_do_nothing (admin_utils.tests.NestedObjectsTests)", "test_queries (admin_utils.tests.NestedObjectsTests)", "test_relation_on_abstract (admin_utils.tests.NestedObjectsTests)", "test_sibl...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
<15 min fix
django/django
django__django-13513
6599608c4d0befdcb820ddccce55f183f247ae4f
diff --git a/django/views/debug.py b/django/views/debug.py --- a/django/views/debug.py +++ b/django/views/debug.py @@ -394,19 +394,19 @@ def _get_lines_from_file(self, filename, lineno, context_lines, loader=None, mod return None, [], None, [] return lower_bound, pre_context, context_line, post_co...
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 @@ -467,6 +467,34 @@ def test_suppressed_context(self): self.assertIn('<p>Request data not supplied</p>', html) self.assertNotI...
debug error view doesn't respect exc.__suppress_context__ (PEP 415) Description Consider the following view that raises an exception: class TestView(View): def get(self, request, *args, **kwargs): try: raise RuntimeError('my error') except Exception as exc: raise ValueError('my new error') from None Even t...
Here is a related (but different) issue about the traceback shown by the debug error view ("debug error view shows no traceback if exc.traceback is None for innermost exception"): https://code.djangoproject.com/ticket/31672 Thanks Chris. Would you like to prepare a patch? PR: ​https://github.com/django/django/pull/1317...
2020-10-08T14:07:33Z
3.2
["test_innermost_exception_without_traceback (view_tests.tests.test_debug.ExceptionReporterTests)"]
["test_sensitive_post_parameters_not_called (view_tests.tests.test_debug.DecoratorsTests)", "test_sensitive_variables_not_called (view_tests.tests.test_debug.DecoratorsTests)", "test_repr (view_tests.tests.test_debug.CallableSettingWrapperTests)", "test_cleansed_substitute_override (view_tests.tests.test_debug.CustomEx...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
15 min - 1 hour
django/django
django__django-13551
7f9e4524d6b23424cf44fbe1bf1f4e70f6bb066e
diff --git a/django/contrib/auth/tokens.py b/django/contrib/auth/tokens.py --- a/django/contrib/auth/tokens.py +++ b/django/contrib/auth/tokens.py @@ -78,9 +78,9 @@ def _make_token_with_timestamp(self, user, timestamp, legacy=False): def _make_hash_value(self, user, timestamp): """ - Hash the use...
diff --git a/tests/auth_tests/models/__init__.py b/tests/auth_tests/models/__init__.py --- a/tests/auth_tests/models/__init__.py +++ b/tests/auth_tests/models/__init__.py @@ -8,6 +8,7 @@ from .no_password import NoPasswordUser from .proxy import Proxy, UserProxy from .uuid_pk import UUIDUser +from .with_custom_email...
Changing user's email could invalidate password reset tokens Description Sequence: Have account with email address foo@… Password reset request for that email (unused) foo@… account changes their email address Password reset email is used The password reset email's token should be rejected at that point, but in fact ...
2020-10-17T17:22:01Z
3.2
["Updating the user email address invalidates the token.", "test_token_with_different_secret (auth_tests.test_tokens.TokenGeneratorTest)"]
["test_str (auth_tests.test_models.GroupTests)", "test_group_natural_key (auth_tests.test_models.NaturalKeysTestCase)", "test_user_natural_key (auth_tests.test_models.NaturalKeysTestCase)", "test_check_password (auth_tests.test_models.AnonymousUserTests)", "test_delete (auth_tests.test_models.AnonymousUserTests)", "tes...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
<15 min fix
django/django
django__django-13569
257f8495d6c93e30ab0f52af4c488d7344bcf112
diff --git a/django/db/models/functions/math.py b/django/db/models/functions/math.py --- a/django/db/models/functions/math.py +++ b/django/db/models/functions/math.py @@ -154,6 +154,9 @@ def as_oracle(self, compiler, connection, **extra_context): def as_sqlite(self, compiler, connection, **extra_context): ...
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -1315,3 +1315,18 @@ def test_aggregation_subquery_annotation_related_field(self): # with self.assertNumQueries(1) as ctx: # self.assertSequenceEqual(books_qs, [...
order_by('?') unexpectedly breaking queryset aggregation Description Steps to reproduce: class Thing(models.Model): pass class Related(models.Model): models.ForeignKey(Thing) With data t = Thing.objects.create() rs = [Related.objects.create(thing=t) for _ in range(2)] The following query works as expected. The aggr...
Patch to SQLCompiler.get_group_by that excluds Random expressions ​PR I wonder what would happen if we skipped all expressions that have no cols as source expressions (plus, we need to include any raw sql). I wonder what would happen if we skipped all expressions that have no cols as source expressions (plus, we need t...
2020-10-19T21:20:55Z
3.2
["Random() is not included in the GROUP BY when used for ordering."]
["test_aggregate_alias (aggregation.tests.AggregateTestCase)", "test_aggregate_annotation (aggregation.tests.AggregateTestCase)", "test_aggregate_in_order_by (aggregation.tests.AggregateTestCase)", "test_aggregate_multi_join (aggregation.tests.AggregateTestCase)", "test_aggregate_over_aggregate (aggregation.tests.Aggre...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
15 min - 1 hour
django/django
django__django-13658
0773837e15bb632afffb6848a58c59a791008fa1
diff --git a/django/core/management/__init__.py b/django/core/management/__init__.py --- a/django/core/management/__init__.py +++ b/django/core/management/__init__.py @@ -344,7 +344,12 @@ def execute(self): # Preprocess options to extract --settings and --pythonpath. # These options could affect the c...
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -17,7 +17,7 @@ from django import conf, get_version from django.conf import settings from django.core.management import ( - BaseCommand, CommandError, call_command, col...
ManagementUtility instantiates CommandParser without passing already-computed prog argument Description ManagementUtility ​goes to the trouble to parse the program name from the argv it's passed rather than from sys.argv: def __init__(self, argv=None): self.argv = argv or sys.argv[:] self.prog_name = os.path.ba...
Tentatively accepted, looks valid but I was not able to reproduce and invalid message (even with mocking sys.argv), so a regression test is crucial.
2020-11-09T20:50:28Z
3.2
["test_program_name_from_argv (admin_scripts.tests.ExecuteFromCommandLine)"]
["test_params_to_runserver (admin_scripts.tests.ManageTestserver)", "test_testserver_handle_params (admin_scripts.tests.ManageTestserver)", "test_no_database (admin_scripts.tests.ManageRunserver)", "test_readonly_database (admin_scripts.tests.ManageRunserver)", "test_runner_addrport_ipv6 (admin_scripts.tests.ManageRuns...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
15 min - 1 hour
django/django
django__django-13786
bb64b99b78a579cb2f6178011a4cf9366e634438
diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py --- a/django/db/migrations/operations/models.py +++ b/django/db/migrations/operations/models.py @@ -137,11 +137,15 @@ def reduce(self, operation, app_label): ), ] elif isinstance(ope...
diff --git a/tests/migrations/test_optimizer.py b/tests/migrations/test_optimizer.py --- a/tests/migrations/test_optimizer.py +++ b/tests/migrations/test_optimizer.py @@ -119,6 +119,42 @@ def test_create_alter_model_options(self): ] ) + def test_create_model_and_remove_model_options(self): + ...
squashmigrations does not unset model options when optimizing CreateModel and AlterModelOptions Description When an operation resembling AlterModelOptions(name="test_model", options={}) is squashed into the corresponding CreateModel operation, model options are not cleared on the resulting new CreateModel operation o...
Makes sense, I guess we should take AlterModelOptions.ALTER_OPTION_KEYS in consideration here like AlterModelOptions.state_forwards does ​https://github.com/django/django/blob/991dce4fc5b656e04af08a595181bd576f2bd857/django/db/migrations/operations/models.py#L675-L677
2020-12-17T21:10:10Z
3.2
["test_create_model_and_remove_model_options (migrations.test_optimizer.OptimizerTests)"]
["test_add_field_alter_field (migrations.test_optimizer.OptimizerTests)", "test_add_field_delete_field (migrations.test_optimizer.OptimizerTests)", "test_add_field_rename_field (migrations.test_optimizer.OptimizerTests)", "test_alter_alter_index_model (migrations.test_optimizer.OptimizerTests)", "test_alter_alter_owrt_...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
15 min - 1 hour
django/django
django__django-13810
429d089d0a8fbd400e0c010708df4f0d16218970
diff --git a/django/core/handlers/base.py b/django/core/handlers/base.py --- a/django/core/handlers/base.py +++ b/django/core/handlers/base.py @@ -51,11 +51,11 @@ def load_middleware(self, is_async=False): middleware_is_async = middleware_can_async try: # Adapt handler, if...
diff --git a/tests/middleware_exceptions/tests.py b/tests/middleware_exceptions/tests.py --- a/tests/middleware_exceptions/tests.py +++ b/tests/middleware_exceptions/tests.py @@ -181,6 +181,25 @@ def test_do_not_log_when_debug_is_false(self): with self.assertLogs('django.request', 'DEBUG'): ...
MiddlewareNotUsed leaves undesired side effects when loading middleware in ASGI context Description I experienced strange issues when working with ​ASGI , ​django-debug-toolbar and my own small middleware. It was hard problem to debug, I uploaded an example project here: ​https://github.com/hbielenia/asgi-djangotoolb...
Many thanks for the detailed report.
2020-12-26T12:31:18Z
3.2
["test_async_and_sync_middleware_chain_async_call (middleware_exceptions.tests.MiddlewareNotUsedTests)"]
["test_missing_root_urlconf (middleware_exceptions.tests.RootUrlconfTests)", "test_do_not_log_when_debug_is_false (middleware_exceptions.tests.MiddlewareNotUsedTests)", "test_log (middleware_exceptions.tests.MiddlewareNotUsedTests)", "test_log_custom_message (middleware_exceptions.tests.MiddlewareNotUsedTests)", "test_...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
15 min - 1 hour
django/django
django__django-13821
e64c1d8055a3e476122633da141f16b50f0c4a2d
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py --- a/django/db/backends/sqlite3/base.py +++ b/django/db/backends/sqlite3/base.py @@ -64,8 +64,10 @@ def list_aggregate(function): def check_sqlite_version(): - if Database.sqlite_version_info < (3, 8, 3): - raise Improp...
diff --git a/tests/backends/sqlite/tests.py b/tests/backends/sqlite/tests.py --- a/tests/backends/sqlite/tests.py +++ b/tests/backends/sqlite/tests.py @@ -30,9 +30,9 @@ class Tests(TestCase): longMessage = True def test_check_sqlite_version(self): - msg = 'SQLite 3.8.3 or later is required (found 3.8...
Drop support for SQLite < 3.9.0 Description (last modified by Tim Graham) Indexes on expressions (see #26167) and the SQLITE_ENABLE_JSON1 compile-time option are supported on ​SQLite 3.9.0+. Ubuntu Xenial ships with SQLite 3.11.0 (which will still by supported by Django) and will EOL in April 2021. Debian Jessi...
2020-12-29T15:16:10Z
3.2
["test_check_sqlite_version (backends.sqlite.tests.Tests)"]
["test_parameter_escaping (backends.sqlite.tests.EscapingChecksDebug)", "test_parameter_escaping (backends.sqlite.tests.EscapingChecks)", "test_no_interpolation (backends.sqlite.tests.LastExecutedQueryTest)", "test_parameter_quoting (backends.sqlite.tests.LastExecutedQueryTest)", "Raise NotSupportedError when aggregati...
65dfb06a1ab56c238cc80f5e1c31f61210c4577d
<15 min fix
django/django
django__django-13925
0c42cdf0d2422f4c080e93594d5d15381d6e955e
diff --git a/django/db/models/base.py b/django/db/models/base.py --- a/django/db/models/base.py +++ b/django/db/models/base.py @@ -1299,6 +1299,11 @@ def check(cls, **kwargs): def _check_default_pk(cls): if ( cls._meta.pk.auto_created and + # Inherited PKs are checked in parents mo...
diff --git a/tests/check_framework/test_model_checks.py b/tests/check_framework/test_model_checks.py --- a/tests/check_framework/test_model_checks.py +++ b/tests/check_framework/test_model_checks.py @@ -376,23 +376,62 @@ def mocked_is_overridden(self, setting): @isolate_apps('check_framework.apps.CheckDefaultPKConfig'...
models.W042 is raised on inherited manually specified primary key. Description I have models which inherit from other models, and they should inherit the primary key. This works fine with Django 3.1. However, if I install Django 3.2 alpha, when I run make_migrations I get the following error messages: System check id...
Hello Uri, thanks for testing out the alpha and the report. These models should not use auto-created primary keys! I already defined the primary key in the ancestor of the model. For example class Entity which class User inherits from. It looks to me like a bug in Django 3.2 alpha. Could you provide a minimal project w...
2021-01-21T08:08:55Z
4.0
["test_auto_created_inherited_pk (check_framework.test_model_checks.ModelDefaultAutoFieldTests)", "test_explicit_inherited_pk (check_framework.test_model_checks.ModelDefaultAutoFieldTests)"]
["test_app_default_auto_field (check_framework.test_model_checks.ModelDefaultAutoFieldTests)", "test_auto_created_inherited_parent_link (check_framework.test_model_checks.ModelDefaultAutoFieldTests)", "test_auto_created_pk (check_framework.test_model_checks.ModelDefaultAutoFieldTests)", "test_default_auto_field_setting...
475cffd1d64c690cdad16ede4d5e81985738ceb4
15 min - 1 hour
django/django
django__django-13933
42e8cf47c7ee2db238bf91197ea398126c546741
diff --git a/django/forms/models.py b/django/forms/models.py --- a/django/forms/models.py +++ b/django/forms/models.py @@ -1284,7 +1284,11 @@ def to_python(self, value): value = getattr(value, key) value = self.queryset.get(**{key: value}) except (ValueError, TypeError, self.query...
diff --git a/tests/forms_tests/tests/test_error_messages.py b/tests/forms_tests/tests/test_error_messages.py --- a/tests/forms_tests/tests/test_error_messages.py +++ b/tests/forms_tests/tests/test_error_messages.py @@ -308,3 +308,16 @@ def test_modelchoicefield(self): self.assertFormErrors(['REQUIRED'], f.clea...
ModelChoiceField does not provide value of invalid choice when raising ValidationError Description (last modified by Aaron Wiegel) Compared with ChoiceField and others, ModelChoiceField does not show the value of the invalid choice when raising a validation error. Passing in parameters with the invalid value an...
This message has been the same literally forever b2b6fc8e3c78671c8b6af2709358c3213c84d119. ​Given that ChoiceField passes the value when raising the error, if you set ​error_messages you should be able to get the result you want. Replying to Carlton Gibson: This message has been the same literally forever b2b6fc8e3c786...
2021-01-26T03:58:23Z
4.0
["test_modelchoicefield_value_placeholder (forms_tests.tests.test_error_messages.ModelChoiceFieldErrorMessagesTestCase)"]
["test_modelchoicefield (forms_tests.tests.test_error_messages.ModelChoiceFieldErrorMessagesTestCase)", "test_booleanfield (forms_tests.tests.test_error_messages.FormsErrorMessagesTestCase)", "test_charfield (forms_tests.tests.test_error_messages.FormsErrorMessagesTestCase)", "test_choicefield (forms_tests.tests.test_e...
475cffd1d64c690cdad16ede4d5e81985738ceb4
<15 min fix
django/django
django__django-14034
db1fc5cd3c5d36cdb5d0fe4404efd6623dd3e8fb
diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py --- a/django/forms/boundfield.py +++ b/django/forms/boundfield.py @@ -2,7 +2,7 @@ from django.core.exceptions import ValidationError from django.forms.utils import flatatt, pretty_name -from django.forms.widgets import Textarea, TextInput +from dj...
diff --git a/tests/forms_tests/field_tests/test_multivaluefield.py b/tests/forms_tests/field_tests/test_multivaluefield.py --- a/tests/forms_tests/field_tests/test_multivaluefield.py +++ b/tests/forms_tests/field_tests/test_multivaluefield.py @@ -10,6 +10,20 @@ beatles = (('J', 'John'), ('P', 'Paul'), ('G', 'George'),...
MultiValueField ignores a required value of a sub field Description (last modified by Takayuki Hirai) A field and a form definition: from django.forms import ( Form, CharField, MultiValueField, MultiWidget, ) class MF(MultiValueField): widget = MultiWidget def __init__(self): fields = [ CharField(req...
Why do you pass required=False in super(MF, self).__init__()? Removing that seems to resolve the issue. I tried to remove required=False, then both INPUT elements in HTML became required. <tr><th><label for="id_mf_0">Mf:</label></th><td><input type="text" name="mf_0" required id="id_mf_0" /> <input type="text" name="mf...
2021-02-22T19:32:50Z
4.0
["test_render_required_attributes (forms_tests.field_tests.test_multivaluefield.MultiValueFieldTest)"]
["test_bad_choice (forms_tests.field_tests.test_multivaluefield.MultiValueFieldTest)", "test_clean (forms_tests.field_tests.test_multivaluefield.MultiValueFieldTest)", "test_clean_disabled_multivalue (forms_tests.field_tests.test_multivaluefield.MultiValueFieldTest)", "test_disabled_has_changed (forms_tests.field_tests...
475cffd1d64c690cdad16ede4d5e81985738ceb4
15 min - 1 hour
django/django
django__django-14053
179ee13eb37348cd87169a198aec18fedccc8668
diff --git a/django/contrib/staticfiles/storage.py b/django/contrib/staticfiles/storage.py --- a/django/contrib/staticfiles/storage.py +++ b/django/contrib/staticfiles/storage.py @@ -226,17 +226,25 @@ def post_process(self, paths, dry_run=False, **options): path for path in paths if matches_pa...
diff --git a/tests/staticfiles_tests/test_storage.py b/tests/staticfiles_tests/test_storage.py --- a/tests/staticfiles_tests/test_storage.py +++ b/tests/staticfiles_tests/test_storage.py @@ -203,6 +203,8 @@ def test_post_processing(self): self.assertIn(os.path.join('cached', 'css', 'window.css'), stats['post_p...
HashedFilesMixin's post_process() yields multiple times for the same file Description As part of fixing #24452, the implementation of HashedFilesMixin (used by both ManifestStaticFilesStorage and CachedStaticFilesStorage) was changed such that it performs several passes against the found files, therefore ensuring tha...
I believe I am running into this as well, which has effectively broken my collectstatic files process. I created a new Django 1.11 project with the admin app enabled. It tries to collect all the admin app files, and during the post-process, it constantly loops, and generates new hashes for the same file until it hits t...
2021-02-25T23:57:27Z
4.0
["post_processing behaves correctly."]
["test_hashed_name (staticfiles_tests.test_storage.TestCollectionNoneHashStorage)", "test_collect_static_files_default_permissions (staticfiles_tests.test_storage.TestStaticFilePermissions)", "test_collect_static_files_permissions (staticfiles_tests.test_storage.TestStaticFilePermissions)", "test_collect_static_files_s...
475cffd1d64c690cdad16ede4d5e81985738ceb4
15 min - 1 hour
django/django
django__django-14089
d01709aae21de9cd2565b9c52f32732ea28a2d98
diff --git a/django/utils/datastructures.py b/django/utils/datastructures.py --- a/django/utils/datastructures.py +++ b/django/utils/datastructures.py @@ -25,6 +25,9 @@ def discard(self, item): def __iter__(self): return iter(self.dict) + def __reversed__(self): + return reversed(self.dict) + ...
diff --git a/tests/utils_tests/test_datastructures.py b/tests/utils_tests/test_datastructures.py --- a/tests/utils_tests/test_datastructures.py +++ b/tests/utils_tests/test_datastructures.py @@ -1,7 +1,7 @@ """ Tests for stuff in django.utils.datastructures. """ - +import collections.abc import copy import pickle ...
Allow calling reversed() on an OrderedSet Description Currently, ​OrderedSet isn't reversible (i.e. allowed to be passed as an argument to Python's ​reversed()). This would be natural to support given that OrderedSet is ordered. This should be straightforward to add by adding a __reversed__() method to OrderedSet.
2021-03-06T20:51:08Z
4.0
["test_reversed (utils_tests.test_datastructures.OrderedSetTests)"]
["test_copy (utils_tests.test_datastructures.CaseInsensitiveMappingTests)", "test_create_with_invalid_key (utils_tests.test_datastructures.CaseInsensitiveMappingTests)", "test_create_with_invalid_values (utils_tests.test_datastructures.CaseInsensitiveMappingTests)", "test_del (utils_tests.test_datastructures.CaseInsens...
475cffd1d64c690cdad16ede4d5e81985738ceb4
<15 min fix
django/django
django__django-14122
bc04941bf811d1ea2c79fb7fc20457ed2c7e3410
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 @@ -125,11 +125,12 @@ def get_group_by(self, select, order_by): cols = expr.get_group_by_cols() for col in cols: expre...
diff --git a/tests/ordering/tests.py b/tests/ordering/tests.py --- a/tests/ordering/tests.py +++ b/tests/ordering/tests.py @@ -2,7 +2,7 @@ from operator import attrgetter from django.db.models import ( - CharField, DateTimeField, F, Max, OuterRef, Subquery, Value, + CharField, Count, DateTimeField, F, Max, Ou...
Meta.ordering fields must not be included in GROUP BY clause Description This continues (closed) [1] ticket. I beleave it was not properly fixed in commit [0ddb4ebf]. While commit [0ddb4ebf] removes ORDER BY when Meta.ordering is used it still does populates GROUP BY with Meta.ordering fields thus leads to wrong aggr...
2021-03-13T19:57:16Z
4.0
["test_default_ordering_does_not_affect_group_by (ordering.tests.OrderingTests)"]
["By default, Article.objects.all() orders by pub_date descending, then", "F expressions can be used in Meta.ordering.", "Override ordering with order_by, which is in the same format as the", "Ordering can be based on fields included from an 'extra' clause", "If the extra clause uses an SQL keyword for a name, it will ...
475cffd1d64c690cdad16ede4d5e81985738ceb4
15 min - 1 hour
django/django
django__django-14155
2f13c476abe4ba787b6cb71131818341911f43cc
diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py --- a/django/urls/resolvers.py +++ b/django/urls/resolvers.py @@ -59,9 +59,16 @@ def __getitem__(self, index): return (self.func, self.args, self.kwargs)[index] def __repr__(self): - return "ResolverMatch(func=%s, args=%s, kwargs=%s...
diff --git a/tests/urlpatterns_reverse/tests.py b/tests/urlpatterns_reverse/tests.py --- a/tests/urlpatterns_reverse/tests.py +++ b/tests/urlpatterns_reverse/tests.py @@ -1141,10 +1141,30 @@ def test_repr(self): self.assertEqual( repr(resolve('/no_kwargs/42/37/')), "ResolverMatch(func...
ResolverMatch.__repr__() doesn't handle functools.partial() nicely. Description (last modified by Nick Pope) When a partial function is passed as the view, the __repr__ shows the func argument as functools.partial which isn't very helpful, especially as it doesn't reveal the underlying function or arguments pro...
2021-03-19T15:44:25Z
4.0
["test_repr (urlpatterns_reverse.tests.ResolverMatchTests)", "test_repr_functools_partial (urlpatterns_reverse.tests.ResolverMatchTests)", "test_resolver_match_on_request (urlpatterns_reverse.tests.ResolverMatchTests)"]
["test_include_2_tuple (urlpatterns_reverse.tests.IncludeTests)", "test_include_2_tuple_namespace (urlpatterns_reverse.tests.IncludeTests)", "test_include_3_tuple (urlpatterns_reverse.tests.IncludeTests)", "test_include_3_tuple_namespace (urlpatterns_reverse.tests.IncludeTests)", "test_include_4_tuple (urlpatterns_reve...
475cffd1d64c690cdad16ede4d5e81985738ceb4
15 min - 1 hour
django/django
django__django-14170
6efc35b4fe3009666e56a60af0675d7d532bf4ff
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 @@ -526,30 +526,46 @@ def adapt_ipaddressfield_value(self, value): """ return value or None - def year_lookup_bounds_f...
diff --git a/tests/db_functions/datetime/test_extract_trunc.py b/tests/db_functions/datetime/test_extract_trunc.py --- a/tests/db_functions/datetime/test_extract_trunc.py +++ b/tests/db_functions/datetime/test_extract_trunc.py @@ -359,9 +359,9 @@ def test_extract_iso_year_func_boundaries(self): week_52_day...
Query optimization in YearLookup breaks filtering by "__iso_year" Description (last modified by Florian Demmer) The optimization to use BETWEEN instead of the EXTRACT operation in ​YearLookup is also registered for the ​"__iso_year" lookup, which breaks the functionality provided by ​ExtractIsoYear when used vi...
2021-03-23T08:53:41Z
4.0
["test_extract_iso_year_func_boundaries (db_functions.datetime.test_extract_trunc.DateFunctionTests)", "test_extract_iso_year_func_boundaries (db_functions.datetime.test_extract_trunc.DateFunctionWithTimeZoneTests)"]
["test_extract_day_func (db_functions.datetime.test_extract_trunc.DateFunctionTests)", "test_extract_duration_unsupported_lookups (db_functions.datetime.test_extract_trunc.DateFunctionTests)", "test_extract_duration_without_native_duration_field (db_functions.datetime.test_extract_trunc.DateFunctionTests)", "test_extra...
475cffd1d64c690cdad16ede4d5e81985738ceb4
15 min - 1 hour
django/django
django__django-14311
5a8e8f80bb82a867eab7e4d9d099f21d0a976d22
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -223,8 +223,13 @@ def get_child_arguments(): # __spec__ is set when the server was started with the `-m` option, # see https://docs.python.org/3/reference/import.html#main-...
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 @@ -23,7 +23,7 @@ from django.utils import autoreload from django.utils.autoreload import WatchmanUnavailable -from .test_module import __mai...
Allow autoreloading of `python -m custom_module runserver` Description (last modified by Mariusz Felisiak) The original fix [1] only attempted to deal with -m foo.bar where bar is a package and __main__.py exists under foo/bar. When a dotted name for a module (for example, foo.bar.baz where baz.py resides under...
Patch It doesn't work in Django 3.1 so I would not call it a regression. Can you send PR via GitHub? Looks fine. The one change I'd make is that I'd change modspec.name.split(".")[-1] == "__main__" to modspec.name == "__main__" or modspec.name.endswith(".__main__") to avoid dumb corner cases like a module named foo.my_...
2021-04-25T02:54:34Z
4.0
["test_run_as_non_django_module_non_package (utils_tests.test_autoreload.TestChildArguments)"]
["test_is_django_module (utils_tests.test_autoreload.TestUtilities)", "test_is_django_path (utils_tests.test_autoreload.TestUtilities)", "test_common_roots (utils_tests.test_autoreload.TestCommonRoots)", "test_no_exception (utils_tests.test_autoreload.TestRaiseLastException)", "test_raises_custom_exception (utils_tests...
475cffd1d64c690cdad16ede4d5e81985738ceb4
15 min - 1 hour
django/django
django__django-14349
a708f39ce67af174df90c5b5e50ad1976cec7cb8
diff --git a/django/core/validators.py b/django/core/validators.py --- a/django/core/validators.py +++ b/django/core/validators.py @@ -92,6 +92,7 @@ class URLValidator(RegexValidator): r'\Z', re.IGNORECASE) message = _('Enter a valid URL.') schemes = ['http', 'https', 'ftp', 'ftps'] + unsafe_chars...
diff --git a/tests/validators/tests.py b/tests/validators/tests.py --- a/tests/validators/tests.py +++ b/tests/validators/tests.py @@ -226,9 +226,15 @@ (URLValidator(), None, ValidationError), (URLValidator(), 56, ValidationError), (URLValidator(), 'no_scheme', ValidationError), - # Trailing newlines ...
URLValidator tests failing on Python versions patched for bpo-43882 Description On Python versions with a fix for ​bpo-43882 (i.e. 3.10.0b1 and the 3.9 git branch, not released yet) the following tests fail: ====================================================================== FAIL: test_validators (validators.tests...
Thanks for the report. We noticed this issue. Duplicate of #32074. For the record, I was wrong that this hasn't been released in 3.9 -- it's part of 3.9.5. It looks that it will be backported to all supported versions of Python.
2021-05-04T20:10:27Z
4.0
["test_validators (validators.tests.TestValidators)"]
["test_domain_whitelist (validators.tests.DeprecationTests)", "test_domain_whitelist_access_warning (validators.tests.DeprecationTests)", "test_domain_whitelist_set_warning (validators.tests.DeprecationTests)", "test_whitelist (validators.tests.DeprecationTests)", "test_whitelist_warning (validators.tests.DeprecationTe...
475cffd1d64c690cdad16ede4d5e81985738ceb4
15 min - 1 hour
django/django
django__django-14351
06fd4df41afb5aa1d681b853c3c08d8c688ca3a5
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 @@ -406,6 +406,15 @@ def process_rhs(self, compiler, connection): self.rhs.add_fields(['pk']) return super().process_rhs(compiler, connection) + d...
diff --git a/tests/aggregation_regress/tests.py b/tests/aggregation_regress/tests.py --- a/tests/aggregation_regress/tests.py +++ b/tests/aggregation_regress/tests.py @@ -1525,6 +1525,14 @@ class DistinctAggregate(Aggregate): allow_distinct = True DistinctAggregate('foo', distinct=True) + @sk...
Q object __or__ appears to get all dunder related's default columns and queryset raises ProgrammingError. Description There appears to be a difference in how Q object aliases are setup, when OR'd. The get_default_columns for this agent__property_groups__id__in only uses 1, where as get_default_columns for this agent_...
Thanks for the report. Can you provide a sample project? (models definition and a complete queryset). I cannot reproduce this issue with provided details. Replying to Mariusz Felisiak: Thanks for the report. Can you provide a sample project? (models definition and a complete queryset). I cannot reproduce this issue wit...
2021-05-05T03:50:44Z
4.0
["test_having_subquery_select (aggregation_regress.tests.AggregationTests)"]
["test_ticket_24748 (aggregation_regress.tests.SelfReferentialFKTests)", "test_existing_join_not_promoted (aggregation_regress.tests.JoinPromotionTests)", "test_non_nullable_fk_not_promoted (aggregation_regress.tests.JoinPromotionTests)", "test_ticket_21150 (aggregation_regress.tests.JoinPromotionTests)", "test_aggrega...
475cffd1d64c690cdad16ede4d5e81985738ceb4
15 min - 1 hour
django/django
django__django-14404
de32fe83a2e4a20887972c69a0693b94eb25a88b
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 @@ -420,14 +420,13 @@ def autocomplete_view(self, request): def catch_all_view(self, request, url): if settings.APPEND_SLASH and not url.endswith('/'): ...
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -6602,6 +6602,42 @@ def test_missing_slash_append_slash_true(self): response = self.client.get(known_url[:-1]) self.assertRedirects(response, known_url, status_code...
catch_all_view() does not support FORCE_SCRIPT_NAME. Description (last modified by SlavaSkvortsov) catch_all_view returns redirect to '%s/' % request.path_info (script name cut off there) instead of '%s/' % request.path (with the script name) Patch - ​https://github.com/django/django/pull/14404
2021-05-17T11:24:06Z
4.0
["test_missing_slash_append_slash_true_force_script_name (admin_views.tests.AdminSiteFinalCatchAllPatternTests)", "test_missing_slash_append_slash_true_script_name (admin_views.tests.AdminSiteFinalCatchAllPatternTests)"]
["test_explicitly_provided_pk (admin_views.tests.GetFormsetsWithInlinesArgumentTest)", "test_implicitly_generated_pk (admin_views.tests.GetFormsetsWithInlinesArgumentTest)", "test_should_be_able_to_edit_related_objects_on_add_view (admin_views.tests.AdminCustomSaveRelatedTests)", "test_should_be_able_to_edit_related_ob...
475cffd1d64c690cdad16ede4d5e81985738ceb4
<15 min fix
django/django
django__django-14534
910ecd1b8df7678f45c3d507dde6bcb1faafa243
diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py --- a/django/forms/boundfield.py +++ b/django/forms/boundfield.py @@ -277,7 +277,7 @@ def template_name(self): @property def id_for_label(self): - return 'id_%s_%s' % (self.data['name'], self.data['index']) + return self.data...
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -720,7 +720,7 @@ class BeatleForm(Form): fields = list(BeatleForm(auto_id=False)['name']) self.assertEqual(len(fields), ...
BoundWidget.id_for_label ignores id set by ChoiceWidget.options Description If you look at the implementation of BoundField.subwidgets class BoundField: ... def subwidgets(self): id_ = self.field.widget.attrs.get('id') or self.auto_id attrs = {'id': id_} if id_ else {} attrs = self.build_widget_attrs(attrs) ...
Hey Jacob — Sounds right: I didn't look in-depth but, if you can put your example in a test case it will be clear enough in the PR. Thanks. Thanks Carlton, I will create a pull request asap. Here is a pull request fixing this bug: ​https://github.com/django/django/pull/14533 (closed without merging) Here is the new pul...
2021-06-17T15:37:34Z
4.0
["If auto_id is provided when initializing the form, the generated ID in", "test_iterable_boundfield_select (forms_tests.tests.test_forms.FormsTestCase)"]
["test_attribute_class (forms_tests.tests.test_forms.RendererTests)", "test_attribute_instance (forms_tests.tests.test_forms.RendererTests)", "test_attribute_override (forms_tests.tests.test_forms.RendererTests)", "test_default (forms_tests.tests.test_forms.RendererTests)", "test_kwarg_class (forms_tests.tests.test_for...
475cffd1d64c690cdad16ede4d5e81985738ceb4
<15 min fix
django/django
django__django-14539
6a5ef557f80a8eb6a758ebe99c8bb477ca47459e
diff --git a/django/utils/html.py b/django/utils/html.py --- a/django/utils/html.py +++ b/django/utils/html.py @@ -283,8 +283,9 @@ def trim_punctuation(lead, middle, trail): middle_unescaped = html.unescape(middle) stripped = middle_unescaped.rstrip(TRAILING_PUNCTUATION_CHARS) if ...
diff --git a/tests/utils_tests/test_html.py b/tests/utils_tests/test_html.py --- a/tests/utils_tests/test_html.py +++ b/tests/utils_tests/test_html.py @@ -250,6 +250,10 @@ def test_urlize(self): 'Search for google.com/?q=! and see.', 'Search for <a href="http://google.com/?q=">google.c...
urlize() does not handle html escaped string and trailing punctuation correctly Description Example: urlize('Search for google.com/?q=1&lt! and see.') # expected output 'Search for <a href="http://google.com/?q=1%3C">google.com/?q=1&lt</a>! and see.' # actual output 'Search for <a href="http://google.com/?q=1%3C">goo...
​https://github.com/django/django/pull/14539/ OK, thanks, the example looks right. It's always delicate but let's take this for review. Related to #26193.
2021-06-19T11:31:16Z
4.0
["test_urlize (utils_tests.test_html.TestUtilsHtml)", "test_urlize_unchanged_inputs (utils_tests.test_html.TestUtilsHtml)"]
["test_conditional_escape (utils_tests.test_html.TestUtilsHtml)", "test_escape (utils_tests.test_html.TestUtilsHtml)", "test_escapejs (utils_tests.test_html.TestUtilsHtml)", "test_format_html (utils_tests.test_html.TestUtilsHtml)", "test_html_safe (utils_tests.test_html.TestUtilsHtml)", "test_html_safe_defines_html_err...
475cffd1d64c690cdad16ede4d5e81985738ceb4
<15 min fix
django/django
django__django-14580
36fa071d6ebd18a61c4d7f1b5c9d17106134bd44
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 @@ -273,7 +273,7 @@ def _format(self): class TypeSerializer(BaseSerializer): def serialize(self): special_cases = [ - (models.M...
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 @@ -658,6 +658,13 @@ def test_serialize_functools_partialmethod(self): def test_serialize_type_none(self): self.assertSerializedEqual(type(None)) + ...
Missing import statement in generated migration (NameError: name 'models' is not defined) Description I found a bug in Django's latest release: 3.2.4. Given the following contents of models.py: from django.db import models class MyField(models.TextField): pass class MyBaseModel(models.Model): class Meta: abstrac...
I could reproduce the issue with 3.2.4, 2.2.24 and the main branch. For what it's worth, the issue doesn't occur if the class MyModel does inherit from MyMixin. MyBaseModel is not necessary to reproduce this issue, it's due to the fact that MyModel doesn't have fields from django.db.models and has custom bases. It look...
2021-07-01T07:38:03Z
4.0
["test_serialize_type_model (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...
475cffd1d64c690cdad16ede4d5e81985738ceb4
<15 min fix
django/django
django__django-14631
84400d2e9db7c51fee4e9bb04c028f665b8e7624
diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py --- a/django/forms/boundfield.py +++ b/django/forms/boundfield.py @@ -1,6 +1,7 @@ import datetime import re +from django.core.exceptions import ValidationError from django.forms.utils import flatatt, pretty_name from django.forms.widgets import ...
diff --git a/tests/forms_tests/tests/test_forms.py b/tests/forms_tests/tests/test_forms.py --- a/tests/forms_tests/tests/test_forms.py +++ b/tests/forms_tests/tests/test_forms.py @@ -2112,15 +2112,47 @@ class DateTimeForm(Form): self.assertEqual(unbound['hi_without_microsec'].value(), now_no_ms) self....
BaseForm's _clean_fields() and changed_data should access values via BoundField Description (last modified by Chris Jerdonek) While working on #32917, I noticed that ​BaseForm._clean_fields() and ​BaseForm.changed_data don't currently access their values through a BoundField object. It would be better for consi...
Here is how to make the failing test I mentioned above (roughly): def test_datetime_clean_initial_callable_disabled(self): - now = datetime.datetime(2006, 10, 25, 14, 30, 45, 123456) - class DateTimeForm(forms.Form): - dt = DateTimeField(initial=lambda: now, disabled=True) + dt = DateTimeField(initial=datetime.datetime...
2021-07-13T09:16:48Z
4.0
["The cleaned value for a form with a disabled DateTimeField and callable", "Cleaning a form with a disabled DateTimeField and callable initial"]
["test_attribute_class (forms_tests.tests.test_forms.RendererTests)", "test_attribute_instance (forms_tests.tests.test_forms.RendererTests)", "test_attribute_override (forms_tests.tests.test_forms.RendererTests)", "test_default (forms_tests.tests.test_forms.RendererTests)", "test_kwarg_class (forms_tests.tests.test_for...
475cffd1d64c690cdad16ede4d5e81985738ceb4
1-4 hours
django/django
django__django-14771
4884a87e022056eda10534c13d74e49b8cdda632
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py --- a/django/utils/autoreload.py +++ b/django/utils/autoreload.py @@ -220,6 +220,11 @@ def get_child_arguments(): py_script = Path(sys.argv[0]) args = [sys.executable] + ['-W%s' % o for o in sys.warnoptions] + if sys.implementation.name...
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 @@ -170,6 +170,7 @@ class TestChildArguments(SimpleTestCase): @mock.patch.dict(sys.modules, {'__main__': django.__main__}) @mock.patch(...
Auto-reloader should pass -X options (for cpython implementation) Description Windows OS $ winpty python -m django startproject my_project $ cd my_project/ $ winpty python -m django startapp my_app $ vi my_app/apps.py # demo for xoptions ... $ cat -n my_app/apps.py 1 from django.apps import AppConfig 2 3 class ...
2021-08-15T07:26:17Z
4.1
["test_xoptions (utils_tests.test_autoreload.TestChildArguments)"]
["test_common_roots (utils_tests.test_autoreload.TestCommonRoots)", "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_ex...
647480166bfe7532e8c471fef0146e3a17e6c0c9
15 min - 1 hour
django/django
django__django-14792
d89f976bddb49fb168334960acc8979c3de991fa
diff --git a/django/utils/timezone.py b/django/utils/timezone.py --- a/django/utils/timezone.py +++ b/django/utils/timezone.py @@ -72,8 +72,11 @@ def get_current_timezone_name(): def _get_timezone_name(timezone): - """Return the name of ``timezone``.""" - return str(timezone) + """ + Return the offset ...
diff --git a/tests/utils_tests/test_timezone.py b/tests/utils_tests/test_timezone.py --- a/tests/utils_tests/test_timezone.py +++ b/tests/utils_tests/test_timezone.py @@ -260,6 +260,31 @@ def test_make_aware_zoneinfo_non_existent(self): self.assertEqual(std.utcoffset(), datetime.timedelta(hours=1)) se...
Reverse time zone conversion in Trunc()/Extract() database functions. Description When using a time zone of "Etc/GMT-10" (or similar) for a Trunc class tzinfo, it appears there's a different behavior as of Django 3.2 in the resulting database query. I think it's due to a change in the return value of timezone._get_ti...
Thanks for the report. Regression in 10d126198434810529e0220b0c6896ed64ca0e88. Reproduced at 4fe3774c729f3fd5105b3001fe69a70bdca95ac3. This problem is also affecting MySQL, the timezone "Etc/GMT-10" is returning "-10" instead of "-10:00". #33037
2021-08-24T09:25:15Z
4.0
["The _get_timezone_name() helper must return the offset for fixed offset", "test_is_aware (utils_tests.test_timezone.TimezoneTests)"]
["test_activate_invalid_timezone (utils_tests.test_timezone.TimezoneTests)", "test_fixedoffset_negative_timedelta (utils_tests.test_timezone.TimezoneTests)", "test_fixedoffset_timedelta (utils_tests.test_timezone.TimezoneTests)", "test_get_default_timezone (utils_tests.test_timezone.TimezoneTests)", "test_get_default_t...
475cffd1d64c690cdad16ede4d5e81985738ceb4
<15 min fix
django/django
django__django-14855
475cffd1d64c690cdad16ede4d5e81985738ceb4
diff --git a/django/contrib/admin/helpers.py b/django/contrib/admin/helpers.py --- a/django/contrib/admin/helpers.py +++ b/django/contrib/admin/helpers.py @@ -209,7 +209,11 @@ def get_admin_url(self, remote_field, remote_obj): remote_field.model._meta.model_name, ) try: - url =...
diff --git a/tests/admin_views/admin.py b/tests/admin_views/admin.py --- a/tests/admin_views/admin.py +++ b/tests/admin_views/admin.py @@ -1142,6 +1142,8 @@ def get_formsets_with_inlines(self, request, obj=None): raw_id_fields=['parent'], ) site2.register(Person, save_as_continue=False) +site2.register(ReadOnlyR...
Wrong URL generated by get_admin_url for readonly field in custom Admin Site Description When a model containing a ForeignKey field is viewed (or edited) in a custom Admin Site, and that ForeignKey field is listed in readonly_fields, the url generated for the link is /admin/... instead of /custom-admin/.... This appe...
Hey Ken, yes seems right. Good spot. Looks like this should have been part of b79088306513d5ed76d31ac40ab3c15f858946ea for #31181 (which was Django 3.2) ​here. However, I don't know if there are any side effects and I have not yet run the full suite of tests on this. Mostly looking for feedback whether I'm on the right...
2021-09-14T01:27:01Z
4.0
["test_readonly_foreignkey_links_custom_admin_site (admin_views.tests.ReadonlyTest)"]
["test_explicitly_provided_pk (admin_views.tests.GetFormsetsWithInlinesArgumentTest)", "test_implicitly_generated_pk (admin_views.tests.GetFormsetsWithInlinesArgumentTest)", "test_should_be_able_to_edit_related_objects_on_add_view (admin_views.tests.AdminCustomSaveRelatedTests)", "test_should_be_able_to_edit_related_ob...
475cffd1d64c690cdad16ede4d5e81985738ceb4
<15 min fix
django/django
django__django-14915
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
<15 min fix
django/django
django__django-15022
e1d673c373a7d032060872b690a92fc95496612e
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 @@ -1031,6 +1031,7 @@ def construct_search(field_name): if search_fields and search_term: orm_lookups = [construct_search(str(search_field)) ...
diff --git a/tests/admin_changelist/admin.py b/tests/admin_changelist/admin.py --- a/tests/admin_changelist/admin.py +++ b/tests/admin_changelist/admin.py @@ -36,6 +36,12 @@ class ParentAdmin(admin.ModelAdmin): list_select_related = ['child'] +class ParentAdminTwoSearchFields(admin.ModelAdmin): + list_filte...
Unnecessary joins in admin changelist query Description Django 1.2.5 Models: class Client(models.Model): name = models.CharField(_('name'), max_length=256) name2 = models.CharField(_('unofficial or obsolete name'), max_length=256, blank=True, null=True) contact_person = models.CharField(_('contact person'), max_le...
patch has been made from Mercurial repository This seems related to #13902 and #15819. Are you able to test if this gets fixed by using Django 1.3 or trunk? Looking at the code, the part that is modified by the patch is not modified in current trunk. The problematic pattern is still there: for bit in self.query.split()...
2021-10-24T17:48:28Z
4.1
["test_many_search_terms (admin_changelist.tests.ChangeListTests)", "All rows containing each of the searched words are returned, where each", "Searches over multi-valued relationships return rows from related"]
["{% get_admin_log %} works if the user model's primary key isn't named", "test_missing_args (admin_changelist.tests.GetAdminLogTests)", "{% get_admin_log %} works without specifying a user.", "test_non_integer_limit (admin_changelist.tests.GetAdminLogTests)", "test_without_as (admin_changelist.tests.GetAdminLogTests)"...
647480166bfe7532e8c471fef0146e3a17e6c0c9
15 min - 1 hour
django/django
django__django-15098
2c7846d992ca512d36a73f518205015c88ed088c
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py --- a/django/utils/translation/trans_real.py +++ b/django/utils/translation/trans_real.py @@ -43,7 +43,7 @@ re.IGNORECASE ) -language_code_prefix_re = _lazy_re_compile(r'^/(\w+([@-]\w+)?)(/|$)') +language_code_prefix_re...
diff --git a/tests/i18n/tests.py b/tests/i18n/tests.py --- a/tests/i18n/tests.py +++ b/tests/i18n/tests.py @@ -1593,22 +1593,41 @@ def test_get_supported_language_variant_null(self): @override_settings( LANGUAGES=[ ('en', 'English'), + ('en-latn-us', 'Latin English'), + ...
Internationalisation didn't support language locale containing both script and region. Description The i18n_patterns didn't work with locale contains both script and region, like en-latn-us. Given settings.py LANGUAGE_CODE = 'en-us' LANGUAGES = [ ('en-us', "English"), ('en-latn-us', "Latin English"), ('en-Latn-US'...
What's the use case of using en-latn-us? Replying to Claude Paroz: What's the use case of using en-latn-us? Our language, Taigi in Taiwan, is denoted by nan in ISO 639-3. nan denoted other languages which are different from Taigi although we are submitting the proposal for new language code this year. So that the langu...
2021-11-17T21:30:07Z
4.1
["test_get_language_from_path_real (i18n.tests.MiscTests)", "test_get_supported_language_variant_null (i18n.tests.MiscTests)"]
["OSError is raised if the default language is unparseable.", "test_ignores_non_mo_files (i18n.tests.TranslationFileChangedTests)", "test_resets_cache_with_mo_files (i18n.tests.TranslationFileChangedTests)", "test_round_away_from_one (i18n.tests.UtilsTests)", "test_lazy (i18n.tests.TestModels)", "test_safestr (i18n.tes...
647480166bfe7532e8c471fef0146e3a17e6c0c9
15 min - 1 hour
django/django
django__django-15103
dd528cb2cefc0db8b91a7ff0a2bc87305b976597
diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -83,10 +83,10 @@ def escapejs_filter(value): @register.filter(is_safe=True) -def json_script(value, element_id): +def json_script(value, element_id=N...
diff --git a/tests/template_tests/filter_tests/test_json_script.py b/tests/template_tests/filter_tests/test_json_script.py --- a/tests/template_tests/filter_tests/test_json_script.py +++ b/tests/template_tests/filter_tests/test_json_script.py @@ -17,3 +17,8 @@ def test_basic(self): '{"a": "testing\\r\\njso...
Make the element_id argument of json_script optional Description I recently had a use-case where I wanted to use json_script but I didn't need any id for it (I was including the <script> inside a <template> so I didn't need an id to refer to it). I can't see any reason (security or otherwise) for the id to be require...
2021-11-19T15:57:54Z
4.1
["test_without_id (template_tests.filter_tests.test_json_script.JsonScriptTests)", "test_json_script_without_id (utils_tests.test_html.TestUtilsHtml)"]
["test_basic (template_tests.filter_tests.test_json_script.JsonScriptTests)", "test_conditional_escape (utils_tests.test_html.TestUtilsHtml)", "test_escape (utils_tests.test_html.TestUtilsHtml)", "test_escapejs (utils_tests.test_html.TestUtilsHtml)", "test_format_html (utils_tests.test_html.TestUtilsHtml)", "test_html_...
647480166bfe7532e8c471fef0146e3a17e6c0c9
15 min - 1 hour
django/django
django__django-15104
a7e7043c8746933dafce652507d3b821801cdc7d
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 @@ -96,7 +96,7 @@ def only_relation_agnostic_fields(self, fields): for name, field in sorted(fields.items()): deconstructio...
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 @@ -2834,6 +2834,28 @@ def test_parse_number(self): expected_number, ) + def test_add_custom_fk_wi...
KeyError with migration autodetector and FK field with hardcoded reference Description Hi, I encountered this issue on an old Django project (probably 10 years old) with tons of models and probably a lot of questionable design decisions. The symptom is that running our test suite in verbose mode doesn't work: $ pytho...
2021-11-19T20:46:58Z
4.1
["test_add_custom_fk_with_hardcoded_to (migrations.test_autodetector.AutodetectorTests)"]
["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...
647480166bfe7532e8c471fef0146e3a17e6c0c9
<15 min fix
django/django
django__django-15161
96e7ff5e9ff6362d9a886545869ce4496ca4b0fb
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 @@ -651,6 +651,7 @@ def relabeled_clone(self, relabels): return self +@deconstructible(path='django.db.models.Func') class Func(SQLiteNumericMixin, Exp...
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -1763,14 +1763,14 @@ def test_update_UUIDField_using_Value(self): def test_deconstruct(self): value = Value('name') path, args, kwargs = value.deconstruct() - ...
Use simplified paths for deconstruct of expressions Description Previously F() deconstructed to: django.db.models.expressions.F(). But since it can also be imported from django.db.models, ​PR #14047 changed it to deconstruct to django.db.models.F(). This simplifies generated migration code where it will be referenced...
I would like to give this a try if someone can guide me on how to proceed with this problem. I don't think much more guidance can be given particular to this ticket. Did you see the example PR? Have you read the contributing guidelines and the first patch tutorial?
2021-12-06T09:06:13Z
4.1
["test_deconstruct (expressions.tests.ValueTests)", "test_deconstruct_output_field (expressions.tests.ValueTests)", "test_serialize_complex_func_index (migrations.test_writer.WriterTests)"]
["test_equal (expressions.tests.OrderByTests)", "test_hash (expressions.tests.OrderByTests)", "test_and (expressions.tests.CombinableTests)", "test_negation (expressions.tests.CombinableTests)", "test_or (expressions.tests.CombinableTests)", "test_reversed_and (expressions.tests.CombinableTests)", "test_reversed_or (ex...
647480166bfe7532e8c471fef0146e3a17e6c0c9
15 min - 1 hour
django/django
django__django-15252
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
15 min - 1 hour
django/django
django__django-15268
0ab58c120939093fea90822f376e1866fc714d1f
diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py --- a/django/db/migrations/operations/models.py +++ b/django/db/migrations/operations/models.py @@ -34,9 +34,12 @@ def references_model(self, name, app_label): def reduce(self, operation, app_label): return ...
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 @@ -1573,21 +1573,13 @@ def test_foo_together_ordering(self): self.assertOperationTypes(changes, 'otherapp', 0, [ 'Alte...
Optimize multiple AlterFooTogether operations into one Description Hi, In #31503 we split the AlterFooTogether (AlterUniqueTogether and AlterIndexTogether) operations into two types of operations. First, a migration will have operations to remove constraints, and then other operations adds the new constraints. This a...
2022-01-01T09:57:13Z
4.1
["index/unique_together also triggers on ordering changes.", "Removed fields will be removed after updating index/unique_together.", "Fields are renamed before updating index/unique_together."]
["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...
647480166bfe7532e8c471fef0146e3a17e6c0c9
1-4 hours
django/django
django__django-15277
30613d6a748fce18919ff8b0da166d9fda2ed9bc
diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py --- a/django/db/models/fields/__init__.py +++ b/django/db/models/fields/__init__.py @@ -1010,7 +1010,8 @@ class CharField(Field): def __init__(self, *args, db_collation=None, **kwargs): super().__init__(*args, **kwargs)...
diff --git a/tests/expressions/tests.py b/tests/expressions/tests.py --- a/tests/expressions/tests.py +++ b/tests/expressions/tests.py @@ -1852,6 +1852,30 @@ def test_resolve_output_field_failure(self): with self.assertRaisesMessage(FieldError, msg): Value(object()).output_field + def test_ou...
Micro-optimisation for Value._resolve_output_field (by modifying CharField.__init__) Description Currently, when you do something like annotate(x=Value('test')) that will eventually probably call down into Value._resolve_output_field() and run the following code: if isinstance(self.value, str): return fields.CharFie...
All tests passed in CI, PR is ​https://github.com/django/django/pull/15277 Force pushing a revised commit which includes a test case that errors without the change, for regression purposes.
2022-01-03T12:14:06Z
4.1
["The output field for a given Value doesn't get cleaned & validated,", "test_raise_empty_expressionlist (expressions.tests.ValueTests)"]
["test_empty_group_by (expressions.tests.ExpressionWrapperTests)", "test_non_empty_group_by (expressions.tests.ExpressionWrapperTests)", "test_and (expressions.tests.CombinableTests)", "test_negation (expressions.tests.CombinableTests)", "test_or (expressions.tests.CombinableTests)", "test_reversed_and (expressions.tes...
647480166bfe7532e8c471fef0146e3a17e6c0c9
<15 min fix
django/django
django__django-15280
973fa566521037ac140dcece73fceae50ee522f1
diff --git a/django/db/models/fields/related_descriptors.py b/django/db/models/fields/related_descriptors.py --- a/django/db/models/fields/related_descriptors.py +++ b/django/db/models/fields/related_descriptors.py @@ -646,8 +646,9 @@ def get_prefetch_queryset(self, instances, queryset=None): # Since we ju...
diff --git a/tests/prefetch_related/tests.py b/tests/prefetch_related/tests.py --- a/tests/prefetch_related/tests.py +++ b/tests/prefetch_related/tests.py @@ -1614,3 +1614,29 @@ def test_retrieves_results_from_prefetched_objects_cache(self): with self.assertNumQueries(4): # AuthorWithAge -> Author...
Deferred fields incorrect when following prefetches back to the "parent" object Description Given the following models: class User(models.Model): email = models.EmailField() kind = models.CharField( max_length=10, choices=[("ADMIN", "Admin"), ("REGULAR", "Regular")] ) class Profile(models.Model): full_name = mo...
When using prefetch_related the retrieved objects are assigned their origin's foreign object so in this case the inner prefetch is performed but entirely discarded because it's the outer's query user (the ones with only email) that are assigned to the prefetched profiles. I guess we should either change the current beh...
2022-01-04T11:16:35Z
4.1
["The prefetched relationship is used rather than populating the reverse"]
["test_bug (prefetch_related.tests.Ticket21410Tests)", "test_bug (prefetch_related.tests.Ticket19607Tests)", "test_m2m_then_m2m (prefetch_related.tests.DefaultManagerTests)", "When intermediary results are prefetched without a destination", "test_bug (prefetch_related.tests.Ticket21760Tests)", "test_foreignkey (prefetc...
647480166bfe7532e8c471fef0146e3a17e6c0c9
15 min - 1 hour
django/django
django__django-15368
e972620ada4f9ed7bc57f28e133e85c85b0a7b20
diff --git a/django/db/models/query.py b/django/db/models/query.py --- a/django/db/models/query.py +++ b/django/db/models/query.py @@ -17,7 +17,7 @@ from django.db.models import AutoField, DateField, DateTimeField, sql from django.db.models.constants import LOOKUP_SEP, OnConflict from django.db.models.deletion impor...
diff --git a/tests/queries/test_bulk_update.py b/tests/queries/test_bulk_update.py --- a/tests/queries/test_bulk_update.py +++ b/tests/queries/test_bulk_update.py @@ -211,6 +211,16 @@ def test_field_references(self): Number.objects.bulk_update(numbers, ['num']) self.assertCountEqual(Number.objects.fil...
bulk_update() does not work with plain F('...') expressions. Description Repro: assign plain F(...) to some model instance field save with bulk_update Example: Code highlighting: >>> from exampleapp.models import SelfRef >>> o = SelfRef.objects.all().first() >>> o.c8 = F('name') # model has char fields 'c8' and 'name...
Thanks for the report. Agreed, we should check resolve_expression like elsewhere. Would you like to provide a patch? Sure, can do a patch. Is this worth to add a test case as well?
2022-01-27T13:44:35Z
4.1
["test_f_expression (queries.test_bulk_update.BulkUpdateTests)"]
["test_batch_size (queries.test_bulk_update.BulkUpdateNoteTests)", "test_foreign_keys_do_not_lookup (queries.test_bulk_update.BulkUpdateNoteTests)", "test_functions (queries.test_bulk_update.BulkUpdateNoteTests)", "test_multiple_fields (queries.test_bulk_update.BulkUpdateNoteTests)", "test_set_field_to_null (queries.te...
647480166bfe7532e8c471fef0146e3a17e6c0c9
<15 min fix
django/django
django__django-15375
beb7ddbcee03270e833b2f74927ccfc8027aa693
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 @@ -65,7 +65,9 @@ def resolve_expression(self, query=None, allow_joins=True, reuse=None, summarize if hasattr(default, 'resolve_expression'): defau...
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -1630,6 +1630,18 @@ def test_aggregation_default_passed_another_aggregate(self): ) self.assertAlmostEqual(result['value'], Decimal('61.72'), places=2) + def te...
aggregate() with 'default' after annotate() crashes. Description I saw this on a PostgreSQL project and reproduced it with SQLite. Django 4.0.1. Annotate (anything) then aggregate works fine: $ ./manage.py shell Python 3.10.2 (main, Jan 21 2022, 19:45:54) [Clang 13.0.0 (clang-1300.0.29.30)] Type 'copyright', 'credits...
Thanks for the report! Would you like to prepare a patch? If not, you can assign it me as 4.0.2 will be issued on Tuesday. I have had a quick look but I got a bit lost. Aggregate.default generates a Coalesce internally so it seems a little lower level. If you have the capacity that would be appreciated. Replying to Ada...
2022-01-28T14:48:03Z
4.1
["test_aggregation_default_after_annotation (aggregation.tests.AggregateTestCase)"]
["test_add_implementation (aggregation.tests.AggregateTestCase)", "test_aggregate_alias (aggregation.tests.AggregateTestCase)", "test_aggregate_annotation (aggregation.tests.AggregateTestCase)", "test_aggregate_in_order_by (aggregation.tests.AggregateTestCase)", "test_aggregate_join_transform (aggregation.tests.Aggrega...
647480166bfe7532e8c471fef0146e3a17e6c0c9
15 min - 1 hour
django/django
django__django-15380
71e7c8e73712419626f1c2b6ec036e8559a2d667
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 @@ -824,7 +824,7 @@ def generate_renamed_fields(self): for app_label, model_name, field_name in sorted(self.new_field_keys - self.old_fi...
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 @@ -1049,6 +1049,26 @@ def test_rename_related_field_preserved_db_column(self): new_name='renamed_foo', ) + def te...
Migration autodetector crashes when renaming a model and field. Description Migration autodetector crashes when renaming a model and field in a single step: $ python manage.py makemigrations Did you rename the test_one.MyModel model to MyModel2? [y/N] y Traceback (most recent call last): File "manage.py", line 22, i...
2022-01-31T19:44:44Z
4.1
["test_rename_field_with_renamed_model (migrations.test_autodetector.AutodetectorTests)"]
["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...
647480166bfe7532e8c471fef0146e3a17e6c0c9
<15 min fix
django/django
django__django-15467
e0442a628eb480eac6a7888aed5a86f83499e299
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 @@ -269,7 +269,9 @@ def formfield_for_foreignkey(self, db_field, request, **kwargs): "class": get_ul_class(self.radio_fields[db_field.name])...
diff --git a/tests/admin_widgets/tests.py b/tests/admin_widgets/tests.py --- a/tests/admin_widgets/tests.py +++ b/tests/admin_widgets/tests.py @@ -21,6 +21,7 @@ CharField, DateField, DateTimeField, + ForeignKey, ManyToManyField, UUIDField, ) @@ -141,6 +142,17 @@ def test_radio_fields_Foreig...
ModelAdmin with defined radio_fields override empty_label Description ModelAdmin drops my "empty_label" and set "default_empty_label". For example: class MyModelAdmin(ModelAdmin): radio_fields = 'myfield', def formfield_for_foreignkey(self, db_field, *args, **kwargs): if db_field.name == 'myfield': kwargs['emp...
Agreed, empty_label from kwargs should take precedence over _('None'). I want to work on this to get familiarised with contributing process. Assigning this to me.
2022-02-27T03:00:31Z
4.1
["test_radio_fields_foreignkey_formfield_overrides_empty_label (admin_widgets.tests.AdminFormfieldForDBFieldTests)"]
["test_CharField (admin_widgets.tests.AdminFormfieldForDBFieldTests)", "test_DateField (admin_widgets.tests.AdminFormfieldForDBFieldTests)", "test_DateTimeField (admin_widgets.tests.AdminFormfieldForDBFieldTests)", "test_EmailField (admin_widgets.tests.AdminFormfieldForDBFieldTests)", "test_FileField (admin_widgets.tes...
647480166bfe7532e8c471fef0146e3a17e6c0c9
<15 min fix
django/django
django__django-15499
d90e34c61b27fba2527834806639eebbcfab9631
diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py --- a/django/db/migrations/operations/models.py +++ b/django/db/migrations/operations/models.py @@ -170,6 +170,19 @@ def reduce(self, operation, app_label): managers=self.managers, ),...
diff --git a/tests/migrations/test_optimizer.py b/tests/migrations/test_optimizer.py --- a/tests/migrations/test_optimizer.py +++ b/tests/migrations/test_optimizer.py @@ -129,6 +129,30 @@ def test_create_alter_model_options(self): ], ) + def test_create_alter_model_managers(self): + se...
Optimize CreateModel + AlterModelManagers to CreateModel Description During migration optimization, CreateModel + AlterModelOptions is reduced to just CreateModel, with the model options. Similarly, CreateModel + AlterModelManagers can become just CreateModel.
2022-03-10T22:32:35Z
4.1
["test_create_alter_model_managers (migrations.test_optimizer.OptimizerTests)"]
["AlterField should optimize into AddField.", "RemoveField should cancel AddField", "RenameField should optimize into AddField", "test_alter_alter_index_model (migrations.test_optimizer.OptimizerTests)", "test_alter_alter_owrt_model (migrations.test_optimizer.OptimizerTests)", "test_alter_alter_table_model (migrations....
647480166bfe7532e8c471fef0146e3a17e6c0c9
<15 min fix
django/django
django__django-15503
859a87d873ce7152af73ab851653b4e1c3ffea4c
diff --git a/django/db/models/fields/json.py b/django/db/models/fields/json.py --- a/django/db/models/fields/json.py +++ b/django/db/models/fields/json.py @@ -172,6 +172,10 @@ def as_sql(self, compiler, connection): class HasKeyLookup(PostgresOperatorLookup): logical_operator = None + def compile_json_path_f...
diff --git a/tests/model_fields/test_jsonfield.py b/tests/model_fields/test_jsonfield.py --- a/tests/model_fields/test_jsonfield.py +++ b/tests/model_fields/test_jsonfield.py @@ -576,6 +576,33 @@ def test_has_any_keys(self): [self.objs[3], self.objs[4], self.objs[6]], ) + def test_has_key_num...
has_key, has_keys, and has_any_keys JSONField() lookups don't handle numeric keys on SQLite, MySQL, and Oracle. Description (last modified by TheTerrasque) Problem When using models.​JSONField() ​has_key lookup with numerical keys on SQLite database it fails to find the keys. Versions: Django: 4.0.3 Python: 3.9...
Duplicate of #30566, see comment. Not a duplicate of #30566 This is django's models.JSONField() not postgres extension JSONField It works as expected on Postgresql, the bug is on SQLite #30566 goes directly against comments for https://code.djangoproject.com/ticket/29504 If different behavior is expected on SQLite (or ...
2022-03-12T06:22:37Z
4.1
["test_has_key_number (model_fields.test_jsonfield.TestQuerying)", "test_has_keys (model_fields.test_jsonfield.TestQuerying)"]
["test_formfield (model_fields.test_jsonfield.TestFormField)", "test_formfield_custom_encoder_decoder (model_fields.test_jsonfield.TestFormField)", "test_custom_encoder (model_fields.test_jsonfield.TestValidation)", "test_invalid_decoder (model_fields.test_jsonfield.TestValidation)", "test_invalid_encoder (model_fields...
647480166bfe7532e8c471fef0146e3a17e6c0c9
1-4 hours
django/django
django__django-15554
59ab3fd0e9e606d7f0f7ca26609c06ee679ece97
diff --git a/django/db/models/sql/query.py b/django/db/models/sql/query.py --- a/django/db/models/sql/query.py +++ b/django/db/models/sql/query.py @@ -1011,7 +1011,7 @@ def count_active_tables(self): """ return len([1 for count in self.alias_refcount.values() if count]) - def join(self, join, reu...
diff --git a/tests/filtered_relation/tests.py b/tests/filtered_relation/tests.py --- a/tests/filtered_relation/tests.py +++ b/tests/filtered_relation/tests.py @@ -211,6 +211,34 @@ def test_internal_queryset_alias_mapping(self): str(queryset.query), ) + def test_multiple(self): + qs = (...
Using multiple FilteredRelation with different filters but for same relation is ignored. Description (last modified by lind-marcus) I have a relation that ALWAYS have at least 1 entry with is_all=True and then I have an optional entry that could have is_all=False but instead have zone set. I'm trying to use Fil...
Thanks for the report! A regression test: tests/filtered_relation/tests.py diff --git a/tests/filtered_relation/tests.py b/tests/filtered_relation/tests.py index 790a90d9e2..1208ddde5f 100644 a b class FilteredRelationTests(TestCase): 211211 str(queryset.query), 212212 ) 213213 214 def test_multiple(self): 215 qs = ( 2...
2022-03-29T10:12:46Z
4.1
["test_multiple (filtered_relation.tests.FilteredRelationTests)"]
["filtered_relation() not only improves performance but also creates", "test_aggregate (filtered_relation.tests.FilteredRelationAnalyticalAggregationTests)", "test_as_subquery (filtered_relation.tests.FilteredRelationTests)", "test_condition_deeper_relation_name (filtered_relation.tests.FilteredRelationTests)", "test_c...
647480166bfe7532e8c471fef0146e3a17e6c0c9
15 min - 1 hour
django/django
django__django-15572
0b31e024873681e187b574fe1c4afe5e48aeeecf
diff --git a/django/template/autoreload.py b/django/template/autoreload.py --- a/django/template/autoreload.py +++ b/django/template/autoreload.py @@ -17,7 +17,7 @@ def get_template_directories(): if not isinstance(backend, DjangoTemplates): continue - items.update(cwd / to_path(dir) for ...
diff --git a/tests/template_tests/test_autoreloader.py b/tests/template_tests/test_autoreloader.py --- a/tests/template_tests/test_autoreloader.py +++ b/tests/template_tests/test_autoreloader.py @@ -81,6 +81,17 @@ def test_reset_all_loaders(self, mock_reset): autoreload.reset_loaders() self.assertEqua...
Django 3.2.4+ autoreload breaks on empty string in TEMPLATES DIRS. Description Django versions > 3.2.3 changes the way template dirs are handled, they are now normalized using pathlib.Path. People having an invalid value in TEMPLATESDIRS? will notice that autoreload stops working. "DIRS": os.getenv("TEMPLATES_DIRS", ...
2022-04-09T09:38:31Z
4.1
["test_template_dirs_ignore_empty_path (template_tests.test_autoreloader.TemplateReloadTests)"]
["test_get_template_directories (template_tests.test_autoreloader.Jinja2TemplateReloadTests)", "test_reset_all_loaders (template_tests.test_autoreloader.Jinja2TemplateReloadTests)", "test_watch_for_template_changes (template_tests.test_autoreloader.Jinja2TemplateReloadTests)", "test_get_template_directories (template_t...
647480166bfe7532e8c471fef0146e3a17e6c0c9
<15 min fix
django/django
django__django-15916
88e67a54b7ed0210c11523a337b498aadb2f5187
diff --git a/django/forms/models.py b/django/forms/models.py --- a/django/forms/models.py +++ b/django/forms/models.py @@ -253,18 +253,11 @@ def __init__(self, options=None): self.help_texts = getattr(options, "help_texts", None) self.error_messages = getattr(options, "error_messages", None) ...
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 @@ -3496,6 +3496,41 @@ class InheritedForm(NewForm): type(NewForm.base_fields[name].widget), ) + def test_custom_callback_in_meta(self): + def ...
Allow ModelForm meta to specify formfield_callback. Description (last modified by Klaas-Jan Gorter) The function django.forms.modelform_factory returns a form class based on the class it recieves as form argument. As an additional argument it accepts a formfield_callback function. When no callback is provided t...
I was always the impression that formfield_callback was solely an allowed kwarg of the modelform_factory function and its friends. I believe this test has been removed from version 2, because I find no equivalent test in tests/model_formsets_regress. From what I can see the patch from #18573 was never committed and thu...
2022-08-04T18:59:18Z
4.2
["test_custom_callback_from_base_form_meta (model_forms.tests.FormFieldCallbackTests)", "test_custom_callback_in_meta (model_forms.tests.FormFieldCallbackTests)"]
["test_modelform_factory_metaclass (model_forms.tests.CustomMetaclassTestCase)", "Regression test for #12960. Make sure the cleaned_data returned from", "Regression for #12596: Calling super from ModelForm.clean() should be", "test_bad_callback (model_forms.tests.FormFieldCallbackTests)", "Using base forms with widgets...
0fbdb9784da915fce5dcc1fe82bac9b4785749e5
15 min - 1 hour
django/django
django__django-15930
63884829acd207404f2a5c3cc1d6b4cd0a822b70
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 @@ -1299,6 +1299,11 @@ def as_sql(self, compiler, connection, template=None, **extra_context): template_params = extra_context sql_params = [] ...
diff --git a/tests/expressions_case/tests.py b/tests/expressions_case/tests.py --- a/tests/expressions_case/tests.py +++ b/tests/expressions_case/tests.py @@ -415,6 +415,16 @@ def test_annotate_with_empty_when(self): self.assertEqual(len(objects), CaseTestModel.objects.count()) self.assertTrue(all(obj...
Case() crashes with ~Q(pk__in=[]). Description The following code generates a syntax error. User.objects.annotate( _a=Case( When(~Q(pk__in=[]), then=Value(True)), default=Value(False), output_field=BooleanField(), ) ).order_by("-a").values("pk") The error is: ProgrammingError: syntax error at or near "THEN"...
Thanks for the report (similar to the #33374 and #26517).
2022-08-07T15:26:41Z
4.2
["test_annotate_with_full_when (expressions_case.tests.CaseExpressionTests)"]
["test_empty_q_object (expressions_case.tests.CaseWhenTests)", "test_invalid_when_constructor_args (expressions_case.tests.CaseWhenTests)", "test_only_when_arguments (expressions_case.tests.CaseWhenTests)", "test_conditional_aggregation_example (expressions_case.tests.CaseDocumentationExamples)", "test_conditional_upda...
0fbdb9784da915fce5dcc1fe82bac9b4785749e5
<15 min fix
django/django
django__django-15957
f387d024fc75569d2a4a338bfda76cc2f328f627
diff --git a/django/db/models/fields/related_descriptors.py b/django/db/models/fields/related_descriptors.py --- a/django/db/models/fields/related_descriptors.py +++ b/django/db/models/fields/related_descriptors.py @@ -64,8 +64,10 @@ class Child(Model): """ from django.core.exceptions import FieldError -from django...
diff --git a/tests/prefetch_related/tests.py b/tests/prefetch_related/tests.py --- a/tests/prefetch_related/tests.py +++ b/tests/prefetch_related/tests.py @@ -1908,3 +1908,67 @@ def test_nested_prefetch_is_not_overwritten_by_related_object(self): self.assertIs(Room.house.is_cached(self.room), True) wi...
Prefetch objects don't work with slices Description ​Prefetch() objects does not work with sliced querysets. For example the following code results in AssertionError: Cannot filter a query once a slice has been taken.: Category.objects.prefetch_related(Prefetch( 'post_set', queryset=Post.objects.all()[:3], to_attr...
It seems to me that #26565 ("Allow Prefetch query to use .values()") is related. Hi ludwik, #26565 is about a different issue. The only way we could support slices would be to extract it from the provided queryset to make it filterable again and apply it when in-memory joining. The prefect queryset would still have to ...
2022-08-13T06:18:25Z
4.2
["test_foreignkey_reverse (prefetch_related.tests.PrefetchLimitTests)", "test_m2m_forward (prefetch_related.tests.PrefetchLimitTests)", "test_m2m_reverse (prefetch_related.tests.PrefetchLimitTests)", "test_reverse_ordering (prefetch_related.tests.PrefetchLimitTests)"]
["The prefetched relationship is used rather than populating the reverse", "test_bug (prefetch_related.tests.Ticket19607Tests)", "When intermediary results are prefetched without a destination", "In-bulk does correctly prefetch objects by not using .iterator()", "test_prefetch_nullable (prefetch_related.tests.NullableT...
0fbdb9784da915fce5dcc1fe82bac9b4785749e5
1-4 hours
django/django
django__django-16136
19e6efa50b603af325e7f62058364f278596758f
diff --git a/django/views/generic/base.py b/django/views/generic/base.py --- a/django/views/generic/base.py +++ b/django/views/generic/base.py @@ -148,7 +148,16 @@ def http_method_not_allowed(self, request, *args, **kwargs): request.path, extra={"status_code": 405, "request": request}, ...
diff --git a/tests/async/tests.py b/tests/async/tests.py --- a/tests/async/tests.py +++ b/tests/async/tests.py @@ -6,8 +6,8 @@ from django.core.cache import DEFAULT_CACHE_ALIAS, caches from django.core.exceptions import ImproperlyConfigured, SynchronousOnlyOperation -from django.http import HttpResponse -from djang...
object HttpResponseNotAllowed can't be used in 'await' expression Description When defining a simple View subclass with only an async "post" method, GET requests to this view cause the following exception: [29/Sep/2022 07:50:48] "GET /demo HTTP/1.1" 500 81134 Method Not Allowed (GET): /demo Internal Server Error: /de...
Yes, looks right. http_method_not_allowed() needs to be adjusted to handle both sync and async cases in the same way as options() Do you have capacity to do a patch quickly? (Otherwise I'll take it on.) Thanks for the report! Regression in 9ffd4eae2ce7a7100c98f681e2b6ab818df384a4. Thank you very much for your confirmat...
2022-09-29T11:47:50Z
4.2
["test_http_method_not_allowed_responds_correctly (async.tests.ViewTests)", "test_mixed_views_raise_error (async.tests.ViewTests)"]
["View and by extension any subclasses that don't define handlers are", "test_options_handler_responds_correctly (async.tests.ViewTests)", "test_views_are_correctly_marked (async.tests.ViewTests)", "test_caches_local (async.tests.CacheTest)", "test_async_unsafe (async.tests.AsyncUnsafeTest)", "Utility class which turns...
0fbdb9784da915fce5dcc1fe82bac9b4785749e5
15 min - 1 hour
django/django
django__django-16139
d559cb02da30f74debbb1fc3a46de0df134d2d80
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 @@ -163,7 +163,9 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) password = self.fields.get("password") if password: - ...
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 @@ -1,5 +1,6 @@ import datetime import re +import urllib.parse from unittest import mock from django.contrib.auth.forms import ( @@ -22,6 +23,7 @@ from django.for...
Accessing UserAdmin via to_field leads to link to PasswordResetForm being broken (404) Description (last modified by Simon Kern) Accessing the UserAdmin via another model's Admin that has a reference to User (with to_field set, e.g., to_field="uuid") leads to the UserAdmin being accessed via an url that looks s...
2022-09-30T08:51:16Z
4.2
["test_link_to_password_reset_in_helptext_via_to_field (auth_tests.test_forms.UserChangeFormTest)"]
["test_field_order (auth_tests.test_forms.PasswordChangeFormTest)", "test_html_autocomplete_attributes (auth_tests.test_forms.PasswordChangeFormTest)", "test_incorrect_password (auth_tests.test_forms.PasswordChangeFormTest)", "test_password_verification (auth_tests.test_forms.PasswordChangeFormTest)", "test_password_wh...
0fbdb9784da915fce5dcc1fe82bac9b4785749e5
<15 min fix
django/django
django__django-16145
93d4c9ea1de24eb391cb2b3561b6703fd46374df
diff --git a/django/core/management/commands/runserver.py b/django/core/management/commands/runserver.py --- a/django/core/management/commands/runserver.py +++ b/django/core/management/commands/runserver.py @@ -129,6 +129,13 @@ def inner_run(self, *args, **options): shutdown_message = options.get("shutdown_mes...
diff --git a/tests/admin_scripts/tests.py b/tests/admin_scripts/tests.py --- a/tests/admin_scripts/tests.py +++ b/tests/admin_scripts/tests.py @@ -1587,6 +1587,21 @@ def test_runserver_addrport(self): call_command(self.cmd, addrport="7000") self.assertServerSettings("127.0.0.1", "7000") + @mock.p...
`runserver 0`'s "Starting development server at <address>" doesn't work Description According to ​tutorial running python manage.py runserver 0:8000 is the same as python manage.py runserver 0.0.0.0:8000 but it's output $ python manage.py runserver 0:8000 Watching for file changes with StatReloader ...
On a Mac I could click that link and have it take me to ​http://0.0.0.0:8000/ What OS are you on? It might even be better to just explicitly change it to say "0.0.0.0" because at least then you can copy & paste it as well … Let's wait to see what the triage team decide 🤷‍♂️ According to the Diátaxis framework, ​a tuto...
2022-10-03T05:09:14Z
4.2
["test_zero_ip_addr (admin_scripts.tests.ManageRunserver)"]
["Program name is computed from the execute_from_command_line()'s argv", "test_params_to_runserver (admin_scripts.tests.ManageTestserver)", "test_testserver_handle_params (admin_scripts.tests.ManageTestserver)", "test_migration_warning_multiple_apps (admin_scripts.tests.ManageRunserverMigrationWarning)", "test_migratio...
0fbdb9784da915fce5dcc1fe82bac9b4785749e5
<15 min fix
django/django
django__django-16263
321ecb40f4da842926e1bc07e11df4aabe53ca4b
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 @@ -405,6 +405,12 @@ def replace_expressions(self, replacements): ) return clone + def get_refs(self): + refs = set() + for expr...
diff --git a/tests/aggregation/tests.py b/tests/aggregation/tests.py --- a/tests/aggregation/tests.py +++ b/tests/aggregation/tests.py @@ -34,6 +34,7 @@ Cast, Coalesce, Greatest, + Lower, Now, Pi, TruncDate, @@ -2084,3 +2085,41 @@ def test_exists_extra_where_with_aggregate(self): ...
Strip unused annotations from count queries Description The query below produces a SQL statement that includes the Count('chapters'), despite not not being used in any filter operations. Book.objects.annotate(Count('chapters')).count() It produces the same results as: Book.objects.count() Django could be more intelli...
Same can be done for exists() WIP PR: ​https://github.com/django/django/pull/8928/files The PR is still marked [WIP] and there are test failures. I have also run into problems with QuerySet.count() being very slow on annotated query sets. Django uses a subquery for the count but injects a group by into the subquery. Th...
2022-11-06T07:38:18Z
4.2
["test_non_aggregate_annotation_pruned (aggregation.tests.AggregateAnnotationPruningTests)", "test_unreferenced_aggregate_annotation_pruned (aggregation.tests.AggregateAnnotationPruningTests)", "test_unused_aliased_aggregate_pruned (aggregation.tests.AggregateAnnotationPruningTests)"]
["test_referenced_aggregate_annotation_kept (aggregation.tests.AggregateAnnotationPruningTests)", "test_add_implementation (aggregation.tests.AggregateTestCase)", "test_aggregate_alias (aggregation.tests.AggregateTestCase)", "test_aggregate_annotation (aggregation.tests.AggregateTestCase)", "test_aggregate_in_order_by ...
0fbdb9784da915fce5dcc1fe82bac9b4785749e5
1-4 hours
django/django
django__django-16429
6c86495bcee22eac19d7fb040b2988b830707cbd
diff --git a/django/utils/timesince.py b/django/utils/timesince.py --- a/django/utils/timesince.py +++ b/django/utils/timesince.py @@ -97,6 +97,7 @@ def timesince(d, now=None, reversed=False, time_strings=None, depth=2): d.hour, d.minute, d.second, + tzinfo=d.tzinfo, ...
diff --git a/tests/utils_tests/test_timesince.py b/tests/utils_tests/test_timesince.py --- a/tests/utils_tests/test_timesince.py +++ b/tests/utils_tests/test_timesince.py @@ -1,7 +1,7 @@ import datetime from django.test import TestCase -from django.test.utils import requires_tz_support +from django.test.utils impor...
timesince() raises TypeError with USE_TZ=True and >1 month interval. Description (last modified by Sage Abdullah) As of 8d67e16493c903adc9d049141028bc0fff43f8c8, calling timesince() with a datetime object that's one month (or more) in the past and the USE_TZ setting is set to True results in the following crash...
Thanks for the report, however test_long_interval_with_tz works for me on the current main branch 🤔 Whoops, sorry, I haven't properly tested the function as I currently don't have a local Django dev environment. I'm testing this on a shell with my Django project, I think this should be reproducible: >>> from django.ut...
2023-01-05T11:41:37Z
4.2
["test_depth (utils_tests.test_timesince.TZAwareTimesinceTests)", "test_depth_invalid (utils_tests.test_timesince.TZAwareTimesinceTests)", "Test other units.", "test_thousand_years_ago (utils_tests.test_timesince.TZAwareTimesinceTests)"]
["Timesince should work with both date objects (#9672)", "Both timesince and timeuntil should work on date objects (#17937).", "When using two different timezones.", "If the two differing units aren't adjacent, only the first unit is", "When the second date occurs before the first, we should always", "equal datetimes."...
0fbdb9784da915fce5dcc1fe82bac9b4785749e5
<15 min fix
django/django
django__django-16485
39f83765e12b0e5d260b7939fc3fe281d879b279
diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -168,7 +168,7 @@ def floatformat(text, arg=-1): except (ValueError, OverflowError, InvalidOperation): return input_val - if not m and p...
diff --git a/tests/template_tests/filter_tests/test_floatformat.py b/tests/template_tests/filter_tests/test_floatformat.py --- a/tests/template_tests/filter_tests/test_floatformat.py +++ b/tests/template_tests/filter_tests/test_floatformat.py @@ -111,6 +111,8 @@ def test_zero_values(self): self.assertEqual( ...
floatformat() crashes on "0.00". Description from decimal import Decimal from django.template.defaultfilters import floatformat floatformat('0.00', 0) floatformat(Decimal('0.00'), 0) Both throw ValueError: valid range for prec is [1, MAX_PREC]
Thanks for the report and testing against the alpha release! Regression in 08c5a787262c1ae57f6517d4574b54a5fcaad124.
2023-01-18T22:03:52Z
5.0
["test_zero_values (template_tests.filter_tests.test_floatformat.FunctionTests.test_zero_values)"]
["test_floatformat01 (template_tests.filter_tests.test_floatformat.FloatformatTests.test_floatformat01)", "test_floatformat02 (template_tests.filter_tests.test_floatformat.FloatformatTests.test_floatformat02)", "test_float_dunder_method (template_tests.filter_tests.test_floatformat.FunctionTests.test_float_dunder_metho...
4a72da71001f154ea60906a2f74898d32b7322a7
15 min - 1 hour
django/django
django__django-16612
55bcbd8d172b689811fae17cde2f09218dd74e9c
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 @@ -453,7 +453,9 @@ def catch_all_view(self, request, url): pass else: if getattr(match.func, "should_append_slash", True): - ...
diff --git a/tests/admin_views/tests.py b/tests/admin_views/tests.py --- a/tests/admin_views/tests.py +++ b/tests/admin_views/tests.py @@ -8463,6 +8463,24 @@ def test_missing_slash_append_slash_true(self): response, known_url, status_code=301, target_status_code=403 ) + @override_settings(APP...
AdminSite.catch_all_view() drops query string in redirects Description #31747 introduced AdminSite.catch_all_view(). However, in the process it broke the ability to redirect with settings.APPEND_SLASH = True when there are query strings. Provided URL: ​http://127.0.0.1:8000/admin/auth/foo?id=123 Expected redirect: ​h...
Thanks for the report! Using get_full_path() should fix the issue: django/contrib/admin/sites.py diff --git a/django/contrib/admin/sites.py b/django/contrib/admin/sites.py index 61be31d890..96c54e44ad 100644 a b class AdminSite: 453453 pass 454454 else: 455455 if getattr(match.func, "should_append_slash", True): 456 re...
2023-03-02T19:06:12Z
5.0
["test_missing_slash_append_slash_true_query_string (admin_views.tests.AdminSiteFinalCatchAllPatternTests.test_missing_slash_append_slash_true_query_string)", "test_missing_slash_append_slash_true_script_name_query_string (admin_views.tests.AdminSiteFinalCatchAllPatternTests.test_missing_slash_append_slash_true_script_...
["test_explicitly_provided_pk (admin_views.tests.GetFormsetsWithInlinesArgumentTest.test_explicitly_provided_pk)", "test_implicitly_generated_pk (admin_views.tests.GetFormsetsWithInlinesArgumentTest.test_implicitly_generated_pk)", "test_secure_view_shows_login_if_not_logged_in (admin_views.tests.SecureViewTests.test_se...
4a72da71001f154ea60906a2f74898d32b7322a7
15 min - 1 hour
django/django
django__django-16667
02c356f2f3945b8075735d485c3cf48cad991011
diff --git a/django/forms/widgets.py b/django/forms/widgets.py --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -1161,6 +1161,8 @@ def value_from_datadict(self, data, files, name): # Return pseudo-ISO dates with zeros for any unselected values, # e.g. '2017-0-23'. ...
diff --git a/tests/forms_tests/field_tests/test_datefield.py b/tests/forms_tests/field_tests/test_datefield.py --- a/tests/forms_tests/field_tests/test_datefield.py +++ b/tests/forms_tests/field_tests/test_datefield.py @@ -1,3 +1,4 @@ +import sys from datetime import date, datetime from django.core.exceptions impor...
SelectDateWidget can crash with OverflowError. Description Given a relatively common view like this: from django import forms from django.forms import SelectDateWidget from django.http import HttpResponse class ReproForm(forms.Form): my_date = forms.DateField(widget=SelectDateWidget()) def repro_view(request): fo...
patch Thanks for this report.
2023-03-20T21:32:53Z
5.0
["test_form_field (forms_tests.field_tests.test_datefield.DateFieldTest.test_form_field)", "test_value_from_datadict (forms_tests.widget_tests.test_selectdatewidget.SelectDateWidgetTest.test_value_from_datadict)"]
["test_datefield_1 (forms_tests.field_tests.test_datefield.DateFieldTest.test_datefield_1)", "test_datefield_2 (forms_tests.field_tests.test_datefield.DateFieldTest.test_datefield_2)", "test_datefield_3 (forms_tests.field_tests.test_datefield.DateFieldTest.test_datefield_3)", "test_datefield_4 (forms_tests.field_tests....
4a72da71001f154ea60906a2f74898d32b7322a7
15 min - 1 hour
django/django
django__django-16801
3b62d8c83e3e48d2ed61cfa32a61c56d9e030293
diff --git a/django/db/models/fields/files.py b/django/db/models/fields/files.py --- a/django/db/models/fields/files.py +++ b/django/db/models/fields/files.py @@ -441,7 +441,8 @@ def contribute_to_class(self, cls, name, **kwargs): # after their corresponding image field don't stay cleared by # Model._...
diff --git a/tests/model_fields/test_imagefield.py b/tests/model_fields/test_imagefield.py --- a/tests/model_fields/test_imagefield.py +++ b/tests/model_fields/test_imagefield.py @@ -5,6 +5,7 @@ from django.core.exceptions import ImproperlyConfigured from django.core.files import File from django.core.files.images i...
ImageField unnecessarily adds a post_init signal handler to the model Description While debugging some performance issues in a Django app, I found a codepath where most of the time was being spent on initializing Django models after fetching from the DB. It turns out that 30% of the time was being spent on evaluating...
2023-04-26T07:23:56Z
5.0
["test_post_init_not_connected (model_fields.test_imagefield.ImageFieldNoDimensionsTests.test_post_init_not_connected)"]
["Assigning ImageField to None clears dimensions.", "Tests assigning an image field through the model's constructor.", "Tests assigning an image in Manager.create().", "The default value for an ImageField is an instance of", "Dimensions are updated correctly in various situations.", "Tests assignment using the field's ...
4a72da71001f154ea60906a2f74898d32b7322a7
<15 min fix
django/django
django__django-16819
0b0998dc151feb77068e2387c34cc50ef6b356ae
diff --git a/django/db/migrations/operations/models.py b/django/db/migrations/operations/models.py --- a/django/db/migrations/operations/models.py +++ b/django/db/migrations/operations/models.py @@ -861,6 +861,11 @@ def describe(self): def migration_name_fragment(self): return "%s_%s" % (self.model_name_l...
diff --git a/tests/migrations/test_optimizer.py b/tests/migrations/test_optimizer.py --- a/tests/migrations/test_optimizer.py +++ b/tests/migrations/test_optimizer.py @@ -1158,3 +1158,17 @@ def test_rename_index(self): ), ] ) + + def test_add_remove_index(self): + self.a...
Reduce Add/RemoveIndex migration operations. Description We should reduce AddIndex/RemoveIndex operations when optimizing migration operations.
2023-05-01T15:20:04Z
5.0
["test_add_remove_index (migrations.test_optimizer.OptimizerTests.test_add_remove_index)"]
["AlterField should optimize into AddField.", "RemoveField should cancel AddField", "RenameField should optimize into AddField", "test_alter_alter_field (migrations.test_optimizer.OptimizerTests.test_alter_alter_field)", "test_alter_alter_index_model (migrations.test_optimizer.OptimizerTests.test_alter_alter_index_mode...
4a72da71001f154ea60906a2f74898d32b7322a7
15 min - 1 hour
django/django
django__django-16877
98f6ada0e2058d67d91fb6c16482411ec2ca0967
diff --git a/django/template/defaultfilters.py b/django/template/defaultfilters.py --- a/django/template/defaultfilters.py +++ b/django/template/defaultfilters.py @@ -444,6 +444,16 @@ def escape_filter(value): return conditional_escape(value) +@register.filter(is_safe=True) +def escapeseq(value): + """ + ...
diff --git a/tests/template_tests/filter_tests/test_escapeseq.py b/tests/template_tests/filter_tests/test_escapeseq.py new file mode 100644 --- /dev/null +++ b/tests/template_tests/filter_tests/test_escapeseq.py @@ -0,0 +1,59 @@ +from django.test import SimpleTestCase +from django.utils.safestring import mark_safe + +f...
New template filter `escapeseq` Description Following #34574, and after some conversations within the security team, it seems appropriate to provide a new template filter escapeseq which would be to escape what safeseq is to safe. An example of usage would be: {{ some_list|escapeseq|join:"," }} where each item of som...
2023-05-19T23:11:10Z
5.0
["test_autoescape_off (template_tests.filter_tests.test_escapeseq.EscapeseqTests.test_autoescape_off)", "test_basic (template_tests.filter_tests.test_escapeseq.EscapeseqTests.test_basic)", "test_chain_join (template_tests.filter_tests.test_escapeseq.EscapeseqTests.test_chain_join)", "test_chain_join_autoescape_off (tem...
[]
4a72da71001f154ea60906a2f74898d32b7322a7
15 min - 1 hour
django/django
django__django-17029
953f29f700a60fc09b08b2c2270c12c447490c6a
diff --git a/django/apps/registry.py b/django/apps/registry.py --- a/django/apps/registry.py +++ b/django/apps/registry.py @@ -373,6 +373,7 @@ def clear_cache(self): This is mostly used in tests. """ + self.get_swappable_settings_name.cache_clear() # Call expire cache on each model. ...
diff --git a/tests/apps/tests.py b/tests/apps/tests.py --- a/tests/apps/tests.py +++ b/tests/apps/tests.py @@ -197,6 +197,17 @@ def test_get_model(self): with self.assertRaises(ValueError): apps.get_model("admin_LogEntry") + @override_settings(INSTALLED_APPS=SOME_INSTALLED_APPS) + def test...
Apps.clear_cache() does not clear get_swappable_settings_name cache. Description We use apps.clear_cache() in django-stubs to be able to reset the previous state on consequential mypy runs. Code: ​https://github.com/typeddjango/django-stubs/pull/1601/files#diff-c49d8fe2cd0a58fad3c36ab3a88c7745e9622f3098e60cd512953eb1...
Thanks for the report, tentatively accepted.
2023-06-29T13:18:26Z
5.0
["test_clear_cache (apps.tests.AppsTests.test_clear_cache)"]
["test_app_default_auto_field (apps.tests.AppConfigTests.test_app_default_auto_field)", "test_default_auto_field_setting (apps.tests.AppConfigTests.test_default_auto_field_setting)", "If single element in __path__, use it (in preference to __file__).", "If the __path__ attr contains duplicate paths and there is no", "I...
4a72da71001f154ea60906a2f74898d32b7322a7
<15 min fix