id
stringlengths
32
49
content
stringlengths
777
333k
swe-bench_data_django__django-11292
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...
swe-bench_data_django__django-11294
Pluralize filter sometimes returns singular form instead of an empty string for invalid inputs Description Filters are documented to return either their input unchanged, or the empty string, whatever makes most sense, when they're used incorrectly. The pluralize filter returns the empty string in such cases, for inst...
swe-bench_data_django__django-11298
Allow ManyToManyField using a intermediary table to be defined as symmetrical. Description Thanks to the work made by Collin Anderson in #9475 I think we can remove the check "fields.E332 Many-to-many fields with intermediate tables must not be symmetrical." with a little adjustment. This change was discussed in the...
swe-bench_data_django__django-11299
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...
swe-bench_data_django__django-11323
Required SelectDateWidget renders invalid HTML Description SelectDateWidget in required field renders an invalid HTML. According to standard ​https://www.w3.org/TR/html5/sec-forms.html#placeholder-label-option every select with required attribute must have a placeholder option, i.e. first option must have an empty st...
swe-bench_data_django__django-11333
Optimization: Multiple URLResolvers may be unintentionally be constructed by calls to `django.urls.resolvers.get_resolver` Description Multiple URLResolvers may be constructed by django.urls.resolvers.get_resolver if django.urls.base.set_urlconf has not yet been called, resulting in multiple expensive calls to URLRes...
swe-bench_data_django__django-11334
Django's template library tags cant use already decorated things like lru_cache because of getfullargspec Description Django's template library tags cant use already decorated things like lru_cache because of getfullargspec. I have a tag that requires to be lru_cached but i cant use it without an helper. The above ex...
swe-bench_data_django__django-11354
QuerySet.count() does not with work raw sql annotations on inherited model fields Description Consider these models class BaseItem(models.Model): title = models.CharField(max_length=32) class Item(BaseItem): pass If I use a RawSQL annotation of Item's queryset that includes one of the fields defined in BaseItem and...
swe-bench_data_django__django-11356
on_delete attribute must be callable. Description If you set on_delete=None as a ForeignKey field parameter you might get the following error: File "django/contrib/admin/options.py", line 1823, in get_deleted_objects return get_deleted_objects(objs, request, self.admin_site) File "django/contrib/admin/utils.py", l...
swe-bench_data_django__django-11359
Automatically resolve Value's output_field for stdlib types. Description Hi, I have a model of AModel. AModel has a SearchVectorField named search_vector. I want to update this vector by indexing a string that is not in any other field. from django.db.models import Value from django.contrib.postgres.search import Se...
swe-bench_data_django__django-11374
Unexpected behavior for django.utils.http.urlencode Description The function django.utils.http.urlencode has been changed to give unexpected result for tuple values (and other iterable objects) in the case when no iterations is expected: >>> django.utils.http.urlencode(dict(a=('a','b')), doseq=False) 'a=%5B%27a%27%2C...
swe-bench_data_django__django-11377
Deprecation message crashes when using a query expression in Model.ordering. Description Since updating to Django 2.2 our test suite fails because the newly introduced deprecation warning which warns about Meta.ordering being ignored from Django 3.1 onwards leads to errors when a query expression is used. Take a mod...
swe-bench_data_django__django-11383
Saving parent object after setting on child leads to unexpected data loss Description (last modified by Erwin Junge) When saving a parent object after setting it on a child object and then saving the child object, no error is thrown but the FK relation is saved with a NULL value. Failing testcase: # Create pa...
swe-bench_data_django__django-11389
Allow SessionStore's to be easily overridden to make dynamic the session cookie age Description If I want to make dynamic my SESSION_COOKIE_AGE setting based on certain parameters of the session I need to reimplement in my SessionStore subclasses the following methods: get_expiry_age get_expiry_date just to override ...
swe-bench_data_django__django-11396
Cannot order query by constant value on PostgreSQL Description (last modified by Sven R. Kunze) MyModel.objects.annotate(my_column=Value('asdf')).order_by('my_column').values_list('id') ProgrammingError: non-integer constant in ORDER BY LINE 1: ...odel"."id" FROM "mymodel" ORDER BY 'asdf' ASC... Does it qualify...
swe-bench_data_django__django-11399
lazy() class preparation is not being cached correctly. Description Doing self.__prepared = True changes the instance, but the intention is to change the class variable: ​https://github.com/django/django/blob/888fdf182e164fa4b24aa82fa833c90a2b9bee7a/django/utils/functional.py#L82 This makes functions like gettext_laz...
swe-bench_data_django__django-11400
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...
swe-bench_data_django__django-11405
Queryset ordering and Meta.ordering are mutable on expressions with reverse(). Description Queryset order and Meta.ordering are mutable with reverse(). Bug revealed by running ./runtests.py ordering.test --reverse (reproduced at a2c31e12da272acc76f3a3a0157fae9a7f6477ac). It seems that test added in f218a2ff455b5f7391...
swe-bench_data_django__django-11417
Update mail backend to use modern standard library parsing approach. Description django.core.mail.message.sanitize_address uses email.utils.parseaddr from the standard lib. On Python 3, email.headerregistry.parser.get_mailbox() does the same, and is less error-prone. diff --git a/django/core/mail/message.py b/djan...
swe-bench_data_django__django-11422
Autoreloader with StatReloader doesn't track changes in manage.py. Description (last modified by Mariusz Felisiak) This is a bit convoluted, but here we go. Environment (OSX 10.11): $ python -V Python 3.6.2 $ pip -V pip 19.1.1 $ pip install Django==2.2.1 Steps to reproduce: Run a server python manage.py runserv...
swe-bench_data_django__django-11423
GenericRelation and prefetch_related: wrong caching with cyclic prefetching. Description Hello @all! I encountered an issue with GenericRelations. Here is an example to reproduce this issue: ​https://github.com/FinnStutzenstein/GenericRelatedPrefetch Just do a migrate and runserver. The code showing the error is star...
swe-bench_data_django__django-11428
Autoreloader crashes on re-raising exceptions with custom signature. Description (last modified by Alan Trick) How to reproduce: In apps.py, put the following code, and update init.py or the settings to have this app config be used. from django.apps import AppConfig class MyException(Exception): def __init__(s...
swe-bench_data_django__django-11433
Allow `cleaned_data` to overwrite fields' default values. Description See comments here: ​https://github.com/django/django/pull/7068/files#r289432409 Currently, when submitting a form, if 'some_field' isn't in the data payload (e.g. it wasn't included in the form, perhaps because its value is derived from another fie...
swe-bench_data_django__django-11446
Default error webpages are not correctly-formed html pages. Description The default page served for the 404 error in "DEBUG=False" mode is (django 2.2.1): <h1>Not Found</h1><p>The requested resource was not found on this server.</p> I would expect that by default, a full webpage is sent to the user, thus: <html> <bod...
swe-bench_data_django__django-11451
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 =...
swe-bench_data_django__django-11457
Improve exceptions about mixed types in Expressions. Description The ​source which raises the exception has enough information to say both what types were found, and which of those were unexpected, and probably have a useful repr() In the test suite, the unexpected output types encountered seem to be DurationField an...
swe-bench_data_django__django-11477
translate_url() creates an incorrect URL when optional named groups are missing in the URL pattern Description There is a problem when translating urls with absent 'optional' arguments (it's seen in test case of the patch) diff --git a/django/urls/resolvers.py b/django/urls/resolvers.py --- a/django/urls/resolvers....
swe-bench_data_django__django-11490
Composed queries cannot change the list of columns with values()/values_list(). Description Composed queries cannot change the list of columns when values()/values_list() is evaluated multiple times, e.g. >>> ReservedName.objects.create(name='a', order=2) >>> qs1 = ReservedName.objects.all() >>> print(qs1.union(qs1)....
swe-bench_data_django__django-11501
Make createsuperuser inspect environment variables for username and password Description The createsuperuser management command is not quite suitable for scripting, even with the --no-input flag, as it doesn't set a password. The management command should inspect some environment variables (e.g. DJANGO_SUPERUSER_{USE...
swe-bench_data_django__django-11514
Add Cache-Control: private to never_cache decorator. Description If a Django user wants to ensure that a resource is not cached. The user might use never_cache decorator, however, sometimes it doesn't work as he or she expected, which means the resource is cached by CDN. The reason why is that CDN providers cache the...
swe-bench_data_django__django-11517
call_command raises ValueError when subparser dest is passed in options. Description If a management command contains subparsers: class Command(BaseCommand): def add_arguments(self, parser): subparsers = parser.add_subparsers(title="subcommands", dest="subcommand", required=True) foo = subp...
swe-bench_data_django__django-11525
Raise exceptions in mail_admins()/mail_managers() when settings are not in expected formats. Description Hi, First time writing a ticket so I apologize if I do anything improperly here. This issue just arose on a project I've been working on, and it goes as follows: Our MANAGERS setting was set like so: MANAGERS = ['...
swe-bench_data_django__django-11527
sqlsequencereset should inform that no sequences found. Description This just came up on IRC, because someone was expecting sqlsequencereset to provide resets for the auto-increment values for an SQLite table. Running python manage.py sqlsequencereset <myapp> provides no output if there are no results returned by con...
swe-bench_data_django__django-11532
Email messages crash on non-ASCII domain when email encoding is non-unicode. Description When the computer hostname is set in unicode (in my case "正宗"), the following test fails: ​https://github.com/django/django/blob/master/tests/mail/tests.py#L368 Specifically, since the encoding is set to iso-8859-1, Python attemp...
swe-bench_data_django__django-11539
Move index name checks from Index.__init__ into system checks. Description (last modified by Mariusz Felisiak) Index names assertions should be moved to system checks to keep code cleaner and more consistent. diff --git a/django/db/models/base.py b/django/db/models/base.py --- a/django/db/models/base.py +++ b...
swe-bench_data_django__django-11543
runserver fails to close connection if --nothreading specified. Description (last modified by Carlton Gibson) Client: Chrome 75.0.3770.100/Firefox 67.0.4 on macOS 10.14.5. Server: macOS 10.14.5., Python 3.7.3, Django 2.2.3 Running runserver with the --nothreading option may stop responding. This is because Web ...
swe-bench_data_django__django-11550
order_by() on union() querysets results with wrong ordering when the same field type is presented multiple times. Description When doing a union of 2 querysets and then doing an order_by on the resulting queryset, if we order on a field whose type is present multiple time, the ordering will be incorrect if the field ...
swe-bench_data_django__django-11551
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...
swe-bench_data_django__django-11555
order_by() a parent model crash when Meta.ordering contains expressions. Description (last modified by Jonny Fuller) Hi friends, During testing I discovered a strange bug when using a query expression for ordering during multi-table inheritance. You can find the full write up as well as reproducible test reposi...
swe-bench_data_django__django-11559
order_by() a parent model crash when Meta.ordering contains expressions. Description (last modified by Jonny Fuller) Hi friends, During testing I discovered a strange bug when using a query expression for ordering during multi-table inheritance. You can find the full write up as well as reproducible test reposi...
swe-bench_data_django__django-11560
Raise ValueError in Extract lookups that don't work properly with DurationField. Description Lookups on ExtractYear on a DurationField fails because ExtractYear has an optimisation where it compares the source date with a range of dates. class MyModel(models.Model): duration = models.DurationField() MyModel.objects....
swe-bench_data_django__django-11564
Add support for SCRIPT_NAME in STATIC_URL and MEDIA_URL Description (last modified by Rostyslav Bryzgunov) By default, {% static '...' %} tag just appends STATIC_URL in the path. When running on sub-path, using SCRIPT_NAME WSGI param, it results in incorrect static URL - it doesn't prepend SCRIPT_NAME prefix. T...
swe-bench_data_django__django-11583
Auto-reloading with StatReloader very intermittently throws "ValueError: embedded null byte". Description Raising this mainly so that it's tracked, as I have no idea how to reproduce it, nor why it's happening. It ultimately looks like a problem with Pathlib, which wasn't used prior to 2.2. Stacktrace: Traceback (mos...
swe-bench_data_django__django-11584
[FATAL] FileNotFoundError with runserver command inside Docker container Description Summary Trying to run the development server in a container with volume-mounted source is throwing a FileNotFoundError. I've verified that the issue is consistently reproducible with Django==2.2.3 and not present in Django==2.1.4. Tr...
swe-bench_data_django__django-11591
Raise a descriptive error on unsupported operations following QuerySet.union(), intersection(), and difference(). Description The documentation for QuerySet.union() says, "In addition, only LIMIT, OFFSET, and ORDER BY (i.e. slicing and order_by()) are allowed on the resulting QuerySet.", however, there isn't any stri...
swe-bench_data_django__django-11592
Start passing FileResponse.block_size to wsgi.file_wrapper. Description (last modified by Chris Jerdonek) I noticed that Django's FileResponse class has a block_size attribute which can be customized by subclassing: ​https://github.com/django/django/blob/415e899dc46c2f8d667ff11d3e54eff759eaded4/django/http/resp...
swe-bench_data_django__django-11603
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...
swe-bench_data_django__django-11605
Filter by window expression should raise a descriptive error. Description Django has a check that filter does not contain window expressions. But it is shallow, neither right side of the expression nor combined expressions are checked. class Employee(models.Model): grade = models.IntegerField() # raises NotSupporte...
swe-bench_data_django__django-11612
SQLite3 migrations can fail when used quoted db_table. Description (last modified by Maciej Olko) If model's Meta db_table is quoted, e.g. '"table_with_quoted_name"', SQLite3 migration with this table creation with can fail with django.db.utils.OperationalError: near "table_with_quoted_name": syntax error. I su...
swe-bench_data_django__django-11618
Cloaking PermissionErrors raised in ManifestFilesMixin.read_manifest(). Description While using the ManifestStaticFilesStorage, I encountered the ValueError shown below. <trim> File "/<some venv>/site-packages/django/contrib/staticfiles/storage.py", line 134, in _url hashed_name = hashed_name_func(*args) File "/<...
swe-bench_data_django__django-11620
When DEBUG is True, raising Http404 in a path converter's to_python method does not result in a technical response Description This is the response I get (plain text): A server error occurred. Please contact the administrator. I understand a ValueError should be raised which tells the URL resolver "this path does no...
swe-bench_data_django__django-11622
Add a helpful exception for invalid values passed to AutoField/FloatField/IntegerField. Description (last modified by Nick Pope) When a large model is updated and saved with invalid values, Django produces a traceback deep within the ORM, with no clue which field assignment caused the error. Developers are face...
swe-bench_data_django__django-11630
Django throws error when different apps with different models have the same name table name. Description Error message: table_name: (models.E028) db_table 'table_name' is used by multiple models: base.ModelName, app2.ModelName. We have a Base app that points to a central database and that has its own tables. We then ...
swe-bench_data_django__django-11638
Improve Exception Message In Test Client and urlencode() when None is passed as data. Description (last modified by Keith Gray) I am upgrading to 2.2.1 from 2.0.5 and my tests are failing due to a change in the test client: ​https://docs.djangoproject.com/en/2.2/releases/2.2/#miscellaneous. It now throws an exc...
swe-bench_data_django__django-11666
Allowing patch_vary_headers() caching utility to handle '*' value. Description Function "patch_vary_headers", simply appends new headers to list. If view code sets Vary header to asterisk, the resulting header (after applying SessionMiddleware and LocaleMiddleware) looks like this: Vary: *, Accept-Language, Cookie Th...
swe-bench_data_django__django-11669
Stop TemplateView automatically passing kwargs into the context Description Only TemplateView pushes self.kwargs to the context. ListView does not, I yet have to check others. This is inconsistency and, I think, it should be fixed. diff --git a/django/views/generic/base.py b/django/views/generic/base.py --- a/djang...
swe-bench_data_django__django-11677
Nested OuterRef not looking on the right model for the field. Description (last modified by Aaron Lisman) I ran into this and made a test case for it. It seems similar to the test case above it. I'm not sure what's different about it and causing it to fail. Let me know if the query is just built wrong. diff --g...
swe-bench_data_django__django-11680
Remove UPDATE query when saving a new model instance with a primary key that has a default Description (last modified by user0007) Using a model's instance: class Account(models.Model): id = models.UUIDField( primary_key=True, default=uuid.uuid4, editable=False ) title = models.TextField() >> account =...
swe-bench_data_django__django-11688
path converters don't handle spaces well. Description This came up for someone on IRC last week, but I can't see that they raised a ticket about it. Correct: >>> from django.urls.resolvers import _route_to_regex >>> _route_to_regex("<uuid:test>") ('^(?P<test>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12...
swe-bench_data_django__django-11692
Can't use OuterRef in union Subquery Description When you make a QuerySet using the union method or the | operator, the QuerySet passed into the union method cannot reference OuterRef even when wrapped with Subquery. For example: cls = Document.objects.filter( checklist__isnull=False, part=OuterRef('id') ).values('...
swe-bench_data_django__django-11695
Rate-limit autocomplete widgets Ajax requests Description (last modified by Federico Jaramillo Martínez) The current implementation of the Ajax autocomplete widget using Select2 in Django triggers a request for every key-press. This creates unnecessary load on servers. This patch rate-limit the requests by addi...
swe-bench_data_django__django-11701
Admin search with a null character crashes with "A string literal cannot contain NUL (0x00) characters." on PostgreSQL Description Input following URL to browser URL field and access. ​http://localhost/admin/auth/user/?q=%00 Crash with following Error. Environment: Request Method: GET Request URL: http://localhost/ad...
swe-bench_data_django__django-11707
Pickling a QuerySet evaluates the querysets given to Subquery in annotate. Description I wrote a test case for tests/queryset_pickle/tests.py modeled after the test from bug #27499 which is very similar. def test_pickle_subquery_queryset_not_evaluated(self): """ Verifies that querysets passed into Subquery expre...
swe-bench_data_django__django-11727
Allow hiding the "Save and Add Another" button with a `show_save_and_add_another` context variable Description To provide better adjustability, to introduce new context var - show_save_and_add_another. E.g. if I want to hide button "Save and add another", I can just modify extra_context - write False to the variable....
swe-bench_data_django__django-11728
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....
swe-bench_data_django__django-11734
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...
swe-bench_data_django__django-11740
Change uuid field to FK does not create dependency Description (last modified by Simon Charette) Hi! I am new in django community, so please help me, because i really dont know is it really "bug". I have a django project named "testproject" and two apps: testapp1, testapp2. It will be simpler to understand, wit...
swe-bench_data_django__django-11742
Add check to ensure max_length fits longest choice. Description There is currently no check to ensure that Field.max_length is large enough to fit the longest value in Field.choices. This would be very helpful as often this mistake is not noticed until an attempt is made to save a record with those values that are to...
swe-bench_data_django__django-11749
call_command fails when argument of required mutually exclusive group is passed in kwargs. Description This error django.core.management.base.CommandError: Error: one of the arguments --shop-id --shop is required is raised when I run call_command('my_command', shop_id=1) the argument 'shop_id' is part of a required...
swe-bench_data_django__django-11751
Make security headers default. Description (last modified by Adam Johnson) Following my security headers talk at DjangoCon Europe and its related blog post ( ​https://adamj.eu/tech/2019/04/10/how-to-score-a+-for-security-headers-on-your-django-website/ ), I'd like to make Django use more of these security heade...
swe-bench_data_django__django-11754
Allow using ExceptionReporter subclass in django.views.debug.technical_500_response Description (last modified by Carlton Gibson) #29714 allows using an ExceptionReporter subclass with AdminEmailHandler. Ideally we'd make the similar available for the 500 debug error view. ​Currently the use of `ExceptionRepo...
swe-bench_data_django__django-11772
Template Cache "make_template_fragment_key" function speed up + simplify (also discussing switch to alternate hashes) Description (last modified by Daniel) The make_template_fragment_key function in django.core.cache.utils has the following (minor) issues: Using urllib.quote for vary_on args, is not needed any ...
swe-bench_data_django__django-11790
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...
swe-bench_data_django__django-11797
Filtering on query result overrides GROUP BY of internal query Description from django.contrib.auth import models a = models.User.objects.filter(email__isnull=True).values('email').annotate(m=Max('id')).values('m') print(a.query) # good # SELECT MAX("auth_user"."id") AS "m" FROM "auth_user" WHERE "auth_user"."email" ...
swe-bench_data_django__django-11808
__eq__ should return NotImplemented when equality cannot be checked. Description (last modified by Elizabeth Uselton) Model.__eq__ never returns NotImplemented if it encounters an object it doesn't know how to compare against. Instead, if the object it is comparing to is not a Django Model, it automatically ret...
swe-bench_data_django__django-11810
Chaining select_related mutates original QuerySet. Description (last modified by Darren Maki) When creating a new QuerySet from an existing QuerySet that has had 'select_related' applied, if you apply another 'select_related' to the new QuerySet it will mutate the original QuerySet to also have the extra 'selec...
swe-bench_data_django__django-11815
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...
swe-bench_data_django__django-11820
models.E015 is raised when Meta.ordering contains "pk" of a related field. Description models.E015 is raised when Meta.ordering contains __pk of a related field, e.g.: test_app.SomeModel: (models.E015) 'ordering' refers to the nonexistent field, related field, or lookup 'option__pk'. Regression in 440505cb2cadbe1a5b9...
swe-bench_data_django__django-11823
cache_control() "max_age" overrides cache_page() "timeout" Description If you decorate a view with both cache_control(max_age=3600) and cache_page(timeout=3600*24), the server side cache uses the max_age value instead of the timeout value. The comments in UpdateCacheMiddleware.process_response() indicate it's trying...
swe-bench_data_django__django-11829
patch_cache_control should special case "no-cache" Description (last modified by Tim Graham) From my cursory reading of ​http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html, it looks like patch_cache_control needs to special case "no-cache". no-cache If the no-cache directive does not specify a field-name, t...
swe-bench_data_django__django-11848
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...
swe-bench_data_django__django-11880
Form Field’s __deepcopy__ does not (deep)copy the error messages. Description The __deepcopy__ method defined for the formfields (​https://github.com/django/django/blob/146086f219d01dbb1cd8c089b5a5667e396e1cc4/django/forms/fields.py#L200) performs a shallow copy of self and does not include additional treatment for t...
swe-bench_data_django__django-11883
Make cache.delete() return whether or not it suceeded. Description It can be quite useful when dealing with complex caching/locking systems or simply for logging purposes. Memcache clients already returns this value and it should be straigtforward to implement for file, inmemory, and database backend based on the num...
swe-bench_data_django__django-11885
Combine fast delete queries Description When emulating ON DELETE CASCADE via on_delete=models.CASCADE the deletion.Collector will try to perform fast queries which are DELETE FROM table WHERE table.pk IN .... There's a few conditions required for this fast path to be taken but when this happens the collection logic s...
swe-bench_data_django__django-11891
ConditionalGetMiddleware returns 304 if ETag is the same but Last-Modified has changed. Description (last modified by Mariusz Felisiak) ConditionalGetMiddleware in combination with apache x-sendfile (django-sendfile) doesn't work properly. Each response gets a ETag generated based on response.content which is a...
swe-bench_data_django__django-11893
DateTimeField doesn't accept ISO 8601 formatted date string Description DateTimeField doesn't accept ISO 8601 formatted date string. Differene is that ISO format allows date and time separator to be capital T letter. (Format being YYYY-MM-DDTHH:MM:SS. Django expects to have only space as a date and time separator. ...
swe-bench_data_django__django-11894
Explicitly SameSite: None cookies. Description When setting cookies (with .set_cookie and set_signed_cookie) the default value for the samesite argument is None but the problem here is that Django doesn't do anything with the None value. This behaviour used to be fine because most browsers assumed that a missing same...
swe-bench_data_django__django-11903
ManagementUtility.fetch_command prints "No Django settings specified." even if they are. Description fetch_command(...) currently ​does the following: if os.environ.get('DJANGO_SETTINGS_MODULE'): # If `subcommand` is missing due to misconfigured settings, the # following line will retrigger an ImproperlyConfigured ...
swe-bench_data_django__django-11905
Prevent using __isnull lookup with non-boolean value. Description (last modified by Mariusz Felisiak) __isnull should not allow for non-boolean values. Using truthy/falsey doesn't promote INNER JOIN to an OUTER JOIN but works fine for a simple queries. Using non-boolean values is ​undocumented and untested. IMO...
swe-bench_data_django__django-11910
ForeignKey's to_field parameter gets the old field's name when renaming a PrimaryKey. Description Having these two models class ModelA(models.Model): field_wrong = models.CharField('field1', max_length=50, primary_key=True) # I'm a Primary key. class ModelB(models.Model): field_fk = models.ForeignKey(ModelA, blank...
swe-bench_data_django__django-11911
"migrate --plan" outputs "IRREVERSIBLE" on RunPython operations without docstrings. Description Given a migration like: from django.db import migrations def forward(apps, schema_editor): pass def reverse(apps, schema_editor): pass class Migration(migrations.Migration): operations = [ migrations.RunPython(forward...
swe-bench_data_django__django-11916
Make prefetch_related faster by lazily creating related querysets Description In one project of mine I will need to prefetch the following things for each "machine": computerdata__operatingsystem, identifiers. computerdata is one-to-one to machine, operatingsystem is manytomany, and identifiers are many-to-one. The d...
swe-bench_data_django__django-11951
bulk_create batch_size param overrides the compatible batch size calculation Description (last modified by Ahmet Kucuk) At this line: ​https://github.com/django/django/blob/stable/2.2.x/django/db/models/query.py#L1197 batch_size param overrides compatible batch size calculation. This looks like a bug as bulk_up...
swe-bench_data_django__django-11964
The value of a TextChoices/IntegerChoices field has a differing type Description If we create an instance of a model having a CharField or IntegerField with the keyword choices pointing to IntegerChoices or TextChoices, the value returned by the getter of the field will be of the same type as the one created by enum....
swe-bench_data_django__django-11983
Admin's date_hierarchy excludes 31 october when using timezone with DST in northern hemisphere. Description https://code.djangoproject.com/ticket/28933 introduced a subtle bug where it accidentally excludes 31 october in the admin date_hierarchy filter after selecting october. The underlying reason is that the genera...
swe-bench_data_django__django-11991
Add support for adding non-key columns to indexes Description (last modified by Hannes Ljungberg) Postgres got support for the INCLUDE clause in CREATE INDEX. This can be used to add non-key columns to the index. CREATE INDEX idx ON t1 ( col1 ) INCLUDE ( col2 ); This allows for Index Only Scans on queries li...
swe-bench_data_django__django-11997
The floatformat filter sometimes returns "-0" instead of "0". Description For values between 0 and -0.5, the floatformat filter returns "-0" where I would expect it to return "0". For example: $ python -m django --version 2.2.5 $ ./manage.py shell Python 3.5.3 (default, Sep 27 2018, 17:25:39) [GCC 6.3.0 20170516] on...
swe-bench_data_django__django-11999
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...
swe-bench_data_django__django-12009
Django installs /usr/bin/django-admin and /usr/bin/django-admin.py Description Django (since 1.7) installs /usr/bin/django-admin and /usr/bin/django-admin.py. Both of them execute django.core.management.execute_from_command_line(). /usr/bin/django-admin.py does it directly, while /usr/bin/django-admin does it through...
swe-bench_data_django__django-12039
Use proper whitespace in CREATE INDEX statements Description (last modified by Hannes Ljungberg) Creating an index through: index = Index( fields=['-name’], name='idx' ) Will generate the valid but not so pretty CREATE INDEX statement: CREATE INDEX "idx" ON "schema_author" ("name"DESC) The following would be...