1
0
mirror of https://github.com/django/django.git synced 2025-03-22 07:10:45 +00:00

19117 Commits

Author SHA1 Message Date
rajdesai24
d5f892d873
Fixed -- Moved csrf_input_lazy, csrf_token_lazy imports to the toplevel.
This prevents random errors with partially initialized modules.
2023-01-06 14:18:29 +01:00
Nick Pope
b47f2f5b90 Fixed -- Optimized LimitedStream wrapper.
The current implementation of LimitedStream is slow because .read()
performs an extra copy into a buffer and .readline() performs two
extra copies. The stream being wrapped is already typically a BytesIO
object so this is unnecessary.

This implementation has largely been untouched for 12 years and,
inspired by a simpler implementation in werkzeug, it was possible to
achieve the following performance improvement:

LimitedStream.read() (single line):
  Mean +- std dev: [bench_limitedstream-main] 286 ns +- 6 ns
  -> [bench_limitedstream-patch] 227 ns +- 6 ns: 1.26x faster
LimitedStream.readline() (single line):
  Mean +- std dev: [bench_limitedstream-main] 507 ns +- 11 ns
  -> [bench_limitedstream-patch] 232 ns +- 8 ns: 2.18x faster
LimitedStream.read(8192) (single line):
  Mean +- std dev: [bench_limitedstream-main] 360 ns +- 8 ns
  -> [bench_limitedstream-patch] 297 ns +- 6 ns: 1.21x faster
LimitedStream.readline(8192) (single line):
  Mean +- std dev: [bench_limitedstream-main] 602 ns +- 10 ns
  -> [bench_limitedstream-patch] 305 ns +- 10 ns: 1.98x faster
LimitedStream.read() (multiple lines):
  Mean +- std dev: [bench_limitedstream-main] 290 ns +- 5 ns
  -> [bench_limitedstream-patch] 236 ns +- 6 ns: 1.23x faster
LimitedStream.readline() (multiple lines):
  Mean +- std dev: [bench_limitedstream-main] 517 ns +- 19 ns
  -> [bench_limitedstream-patch] 239 ns +- 7 ns: 2.16x faster
LimitedStream.read(8192) (multiple lines):
  Mean +- std dev: [bench_limitedstream-main] 363 ns +- 8 ns
  -> [bench_limitedstream-patch] 311 ns +- 11 ns: 1.17x faster
LimitedStream.readline(8192) (multiple lines):
  Mean +- std dev: [bench_limitedstream-main] 601 ns +- 12 ns
  -> [bench_limitedstream-patch] 308 ns +- 7 ns: 1.95x faster

Geometric mean: 1.59x faster
2023-01-05 19:26:56 +01:00
Nick Pope
57f5669d23 Refs -- Improved implementation of FakePayload.
FakePayload is a wrapper around io.BytesIO and is expected to
masquerade as though it is a file-like object. For that reason it makes
sense that it should inherit the correct signatures from io.BytesIO
methods.

Crucially an implementation of .readline() is added which will be
necessary for this to behave more like the expected file-like objects as
LimitedStream will be changed to defer to the wrapped stream object
rather than rolling its own implementation for improved performance.

It should be safe to adjust these signatures because FakePayload is
only used internally within test client helpers, is undocumented, and
thus private.
2023-01-05 19:25:25 +01:00
sag᠎e
8cf3831822
Fixed -- Fixed timesince() crash with timezone-aware dates and interval longer than 1 month.
Regression in 8d67e16493c903adc9d049141028bc0fff43f8c8.
2023-01-05 16:38:19 +01:00
Mariusz Felisiak
7d9329935a
Refs -- Bumped mysqlclient requirement to >= 1.4.3.
mysqlclient 1.4.3 is the first release to support Python 3.8.
2023-01-05 16:34:14 +01:00
Nick Pope
6c86495bce Simplified handling ambiguous/imaginary datetimes in django.utils.dateformat.
Instead of the separate property, we can just not set self.timezone if
the datetime is ambiguous or imaginary. This ensures that this check
will only ever happen once as it's dependant on the datetime object and
not the format string characters.
2023-01-05 12:55:28 +01:00
Nick Pope
65477fd7da Added support for datetime.date to DateFormat.r(). 2023-01-05 12:51:55 +01:00
Nick Pope
41ca2afd1c Simplified django.utils.dateformat.DateFormat.O()/t()/e() a bit.
O() - we should try to avoid calling specifier methods from each other
to avoid extra function call overhead. In addition we end up, in this
case, duplicating the ambiguous/imaginary datetime checks. We're also
going to be looking at simplifying things by having all of these
specifier methods return strings and not an random mix of types.

t() - the value can only be one of 28, 29, 30, or 31. As such, there is
no need to zero-pad to a width of two.
2023-01-05 05:59:26 +01:00
Nick Pope
d7a8ab3513 Optimized imports in django.utils.dateformat.
Avoid extra attribute lookup in specifier methods, etc. by importing
classes from datetime directly.
2023-01-05 05:57:50 +01:00
Nick Pope
0fdc5d79b6 Simplified django.utils.formats.date_format()/time_format() calls.
This removes redundant get_format() calls and passing a default value
for the format argument.
2023-01-04 11:47:14 +01:00
Mariusz Felisiak
5cf9ff970e
Fixed -- Updated admin's jQuery to 3.6.3. 2023-01-04 11:28:09 +01:00
GianpaoloBranca
8d67e16493
Fixed -- Improved timesince handling of long intervals. 2023-01-04 11:14:06 +01:00
Simon Charette
0d3ccf7512 Simplified SQLCompiler.get_group_by() a bit. 2023-01-04 08:32:27 +01:00
Mike Crute
0b78ac3fc7 Fixed -- Made the session role configurable on PostgreSQL. 2023-01-03 09:30:53 +01:00
Claude Paroz
2a14b8df39 Fixed -- Added IsEmpty GIS database function and __isempty lookup on PostGIS. 2023-01-03 05:47:44 +01:00
Florian Apolloner
afa2e28205 Fixed -- Added ManifestFilesMixin.manifest_hash attribute.
This adds ManifestFilesMixin.manifest_hash attribute exposing a "hash"
of the full manifest. This allows applications to determine when their
static files have changed.
2023-01-02 09:53:52 +01:00
Mariusz Felisiak
ecbb5db65d
Fixed -- Confirmed support for GDAL 3.6. 2022-12-29 11:35:41 +01:00
Paul Schilling
298d02a77a Fixed -- Added case-insensitive unique username validation in UserCreationForm.
Co-Authored-By: Neven Mundar <nmundar@gmail.com>
2022-12-29 09:42:22 +01:00
Claude Paroz
1833eb3f3e
Upgraded OpenLayers to v.7.2.2. 2022-12-29 08:30:30 +01:00
Adrian Torres
7eee1dca42 Fixed -- Added support for unlimited CharField on PostgreSQL.
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-28 12:31:04 +01:00
kimsoungryoul
78f163a4fb Fixed -- Added support for comments on columns and tables.
Thanks Jared Chung, Tom Carrick, David Smith, Nick Pope, and Mariusz
Felisiak for reviews.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Nick Pope <nick@nickpope.me.uk>
2022-12-28 06:28:07 +01:00
DevilsAutumn
68ef274bc5 Fixed -- Fixed migration crash when removing check constraints on MySQL < 8.0.16. 2022-12-27 07:11:13 +01:00
朱穆穆
bbeeb45161 Fixed -- Fixed QuerySet.select_related() with multiple FilteredRelations to the OneToOneField. 2022-12-27 06:39:38 +01:00
Mariusz Felisiak
48b6108e50
Used allow_migrate_model() shortcut in Field._check_backend_specific_checks(). 2022-12-24 21:16:22 +01:00
Mariusz Felisiak
e07e83589b
Refs -- Renamed local field variables in SQLCompiler.get_related_selections() to avoid redefinition. 2022-12-24 21:04:59 +01:00
David Wobrock
5aaad5f39c Fixed -- Made permissions creation respect the "using" parameter. 2022-12-24 11:58:33 +01:00
Carlton Gibson
0bd2c0c901 Fixed -- Added async support to StreamingHttpResponse.
Thanks to Florian Vazelle for initial exploratory work, and to Nick
Pope and Mariusz Felisiak for review.
2022-12-22 10:41:12 +01:00
Mariusz Felisiak
ae0899be0d
Fixed -- Preserved Char/TextField.db_collation when altering column type.
This moves setting a database collation to the column type alteration
as both must be set at the same time.

This should also avoid another layer of the column type alteration when
adding database comments support ().
2022-12-22 07:12:17 +01:00
Mariusz Felisiak
2d676ee119 Updated translations from Transifex.
Updated Bulgarian, Esperanto, Hungarian, Japanese, Macedonian, Persian,
Portuguese (Brazil), Russian, Spanish, and Turkmen translations.

Forwardport of 46b28bbe151282e9198b719d00f84b48c92606ba from stable/4.1.x.
2022-12-20 19:34:59 +01:00
Carlton Gibson
32d70b2f55
Refs -- Adopted asgiref coroutine detection shims.
Thanks to Mariusz Felisiak for review.
2022-12-20 11:10:48 +01:00
Roxane
289e9a75af Fixed -- Allowed Sitemap to customize languages for each item. 2022-12-19 12:51:52 +01:00
Andreas Pelme
ab7a85ac29 Fixed -- Implemented Heal The Breach (HTB) in GzipMiddleware. 2022-12-17 08:46:37 +01:00
Leo
a1bcdc94da Fixed -- Made RedisCacheClient.incr() use write connection.
Co-authored-by: Sin-Woo Bang <sinwoobang@gmail.com>
2022-12-16 19:13:03 +01:00
Daniele Varrazzo
09ffc5c121 Fixed -- Added support for psycopg version 3.
Thanks Simon Charette, Tim Graham, and Adam Johnson for reviews.

Co-authored-by: Florian Apolloner <florian@apolloner.eu>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2022-12-15 06:17:57 +01:00
Marti Raudsepp
32268456d6 Fixed -- Prevented FileBasedCache.has_key() crash caused by a race condition. 2022-12-13 19:29:15 +01:00
Nimra Aftab
1d0fa848e0 Fixed -- Improved color contrast for links in admin. 2022-12-13 08:40:14 +01:00
Jarek Pacocha
4cc900bcbf
Made urls.py docstring consistent with other files in project template. 2022-12-13 05:28:55 +01:00
Florian Apolloner
db7bb3b64e Refs -- Added DatabaseOperations.compose_sql() on PostgreSQL. 2022-12-12 10:36:45 +01:00
Florian Apolloner
1d90c9b113 Refs -- Added psycopg_any.IsolationLevel. 2022-12-12 10:36:42 +01:00
Florian Apolloner
2f38f7b8f9 Refs -- Added psycopg_any.sql.quote() hook. 2022-12-12 10:35:38 +01:00
Florian Apolloner
2ebfbd894e Refs -- Moved psycopg2 imports to the psycopg_any module. 2022-12-12 08:36:17 +01:00
James Gillard
c5ed884eab Fixed -- Fixed Meta.constraints validation crash with ArrayField and __len lookup.
Regression in 88fc9e2826044110b7b22577a227f122fe9c1fb5 that began
manifesting in Django 4.1.
2022-12-10 17:46:13 +01:00
SirAbhi13
b8738aea14 Fixed -- Deprecated passing positional arguments to Signer/TimestampSigner.
Thanks Jacob Walls for the implementation idea.
2022-12-09 12:44:48 +01:00
Mariusz Felisiak
cbc0fb3705
Made inspectdb used Cursor.description.display_size for CharFields' max_length.
internal_size is size for fixed-size types not for char types.
2022-12-08 09:00:35 +01:00
Mariusz Felisiak
95a101a690
Fixed -- Bumped minimum supported SQLite to 3.21.0. 2022-12-08 05:53:18 +01:00
James Bligh
e44d348c99
Fixed -- Added ES module support to ManifestStaticFilesStorage.
Co-authored-by: James Bligh <james.bligh@silvercloudhealth.com>
2022-12-07 10:56:00 +01:00
Florian Apolloner
6a21658163 Refs -- Modernized database wrapper in the PostgreSQL backend.
- Used connection.info instead of connection.get_parameter_status() and
  connection.server_info which don't exist in psycopg 3.
- Set encoding using the client_encoding connection parameter instead
  of connection.set_client_encoding() that doesn't exist in psycopg 3.
- Used the dbname connection parameter instead of deprecated
  alias - database.
2022-12-06 12:48:16 +01:00
Alex Vandiver
cbce427c17 Fixed -- Added django.utils.http.content_disposition_header(). 2022-12-05 13:08:00 +01:00
Mariusz Felisiak
3d3e955efa
Removed redundant definition of DatabaseFeatures.can_release_savepoints on MySQL. 2022-12-05 12:08:21 +01:00
Florian Apolloner
2fecf99ade Refs -- Made PostGISAdapter do not use psycopg2's Binary(). 2022-12-02 09:46:57 +01:00