Skip to content

Commit

Permalink
Merge pull request #2 from django/main
Browse files Browse the repository at this point in the history
merge
  • Loading branch information
bukowa committed Feb 7, 2023
2 parents 246eb48 + b4cdcbf commit f583056
Show file tree
Hide file tree
Showing 284 changed files with 708 additions and 354 deletions.
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ c5cd8783825b5f6384417dac5f3889b4210b7d08
9c19aff7c7561e3a82978a272ecdaad40dda5c00
7119f40c9881666b6f9b5cf7df09ee1d21cc8344
c18861804feb6a97afbeabb51be748dd60a04458
097e3a70c1481ee7b042b2edd91b2be86fb7b5b6
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/psf/black
rev: 22.10.0
rev: 23.1.0
hooks:
- id: black
exclude: \.py-tpl$
Expand Down
2 changes: 2 additions & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ answer newbie questions, and generally made Django that much better:
Florian Apolloner <florian@apolloner.eu>
Florian Demmer <fdemmer@gmail.com>
Florian Moussous <florian.moussous@gmail.com>
fnaimi66 <https://github.com/fnaimi66>
Fran Hrženjak <fran.hrzenjak@gmail.com>
Francesco Panico <panico.francesco@gmail.com>
Francisco Albarran Cristobal <pahko.xd@gmail.com>
Expand Down Expand Up @@ -807,6 +808,7 @@ answer newbie questions, and generally made Django that much better:
Radek Švarz <https://www.svarz.cz/translate/>
Rafael Giebisch <rafael@giebisch-mail.de>
Raffaele Salmaso <raffaele@salmaso.org>
Rahmat Faisal <mad.skidipap@gmail.com>
Rajesh Dhawan <rajesh.dhawan@gmail.com>
Ramez Ashraf <ramezashraf@gmail.com>
Ramil Yanbulatov <rayman1104@gmail.com>
Expand Down
1 change: 0 additions & 1 deletion django/contrib/admin/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("contenttypes", "__first__"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class Migration(migrations.Migration):

dependencies = [
("admin", "0001_initial"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("admin", "0002_logentry_remove_auto_add"),
]
Expand Down
3 changes: 2 additions & 1 deletion django/contrib/admin/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,7 @@ def _get_base_actions(self):
base_action_names = {name for _, name, _ in base_actions}

# Gather actions from the admin site first
for (name, func) in self.admin_site.actions:
for name, func in self.admin_site.actions:
if name in base_action_names:
continue
description = self._get_action_description(func, name)
Expand Down Expand Up @@ -1106,6 +1106,7 @@ def get_search_results(self, request, queryset, search_term):
Return a tuple containing a queryset to implement the search
and a boolean indicating if the results may contain duplicates.
"""

# Apply keyword searches.
def construct_search(field_name):
if field_name.startswith("^"):
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/admin/static/admin/js/filters.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
}

Object.entries(filters).forEach(([key, value]) => {
const detailElement = document.querySelector(`[data-filter-title='${key}']`);
const detailElement = document.querySelector(`[data-filter-title='${CSS.escape(key)}']`);

// Check if the filter is present, it could be from other view.
if (detailElement) {
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/admin/templatetags/admin_modify.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def submit_row(context):
and context.get("show_delete", True)
),
"show_save_as_new": not is_popup
and has_change_permission
and has_add_permission
and change
and save_as,
"show_save_and_add_another": can_save_and_add_another,
Expand Down
1 change: 0 additions & 1 deletion django/contrib/admin/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ def process_response(self, request, response):

@modify_settings(MIDDLEWARE={"append": "django.contrib.admin.tests.CSPMiddleware"})
class AdminSeleniumTestCase(SeleniumTestCase, StaticLiveServerTestCase):

available_apps = [
"django.contrib.admin",
"django.contrib.auth",
Expand Down
5 changes: 4 additions & 1 deletion django/contrib/admindocs/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,9 @@ def parse_rst(text, default_reference_context, thing_being_parsed=None):


def create_reference_role(rolename, urlbase):
# Views and template names are case-sensitive.
is_case_sensitive = rolename in ["template", "view"]

def _role(name, rawtext, text, lineno, inliner, options=None, content=None):
if options is None:
options = {}
Expand All @@ -111,7 +114,7 @@ def _role(name, rawtext, text, lineno, inliner, options=None, content=None):
urlbase
% (
inliner.document.settings.link_base,
text.lower(),
text if is_case_sensitive else text.lower(),
)
),
**options,
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/admindocs/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def get_context_data(self, **kwargs):
view_functions = extract_views_from_urlpatterns(url_resolver.url_patterns)
except ImproperlyConfigured:
view_functions = []
for (func, regex, namespace, name) in view_functions:
for func, regex, namespace, name in view_functions:
views.append(
{
"full_name": get_view_name(func),
Expand Down
2 changes: 1 addition & 1 deletion django/contrib/auth/hashers.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ class PBKDF2PasswordHasher(BasePasswordHasher):
"""

algorithm = "pbkdf2_sha256"
iterations = 580000
iterations = 720000
digest = hashlib.sha256

def encode(self, password, salt, iterations=None):
Expand Down
1 change: 0 additions & 1 deletion django/contrib/auth/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@


class Migration(migrations.Migration):

dependencies = [
("contenttypes", "__first__"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("auth", "0001_initial"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("auth", "0002_alter_permission_name_max_length"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class Migration(migrations.Migration):

dependencies = [
("auth", "0003_alter_user_email_max_length"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("auth", "0004_alter_user_username_opts"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("auth", "0005_alter_user_last_login_null"),
("contenttypes", "0002_remove_content_type_name"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class Migration(migrations.Migration):

dependencies = [
("auth", "0006_require_contenttypes_0002"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class Migration(migrations.Migration):

dependencies = [
("auth", "0007_alter_validators_add_error_messages"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("auth", "0008_alter_user_username_max_length"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("auth", "0009_alter_user_last_name_max_length"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("auth", "0011_update_proxy_permissions"),
]
Expand Down
4 changes: 2 additions & 2 deletions django/contrib/auth/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
class ASCIIUsernameValidator(validators.RegexValidator):
regex = r"^[\w.@+-]+\Z"
message = _(
"Enter a valid username. This value may contain only ASCII letters, "
"numbers, and @/./+/-/_ characters."
"Enter a valid username. This value may contain only unaccented lowercase a-z "
"and uppercase A-Z letters, numbers, and @/./+/-/_ characters."
)
flags = re.ASCII

Expand Down
1 change: 0 additions & 1 deletion django/contrib/contenttypes/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class Migration(migrations.Migration):

dependencies = []

operations = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ def add_legacy_name(apps, schema_editor):


class Migration(migrations.Migration):

dependencies = [
("contenttypes", "0001_initial"),
]
Expand Down
1 change: 0 additions & 1 deletion django/contrib/flatpages/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("sites", "0001_initial"),
]
Expand Down
1 change: 0 additions & 1 deletion django/contrib/gis/db/backends/oracle/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@ def as_sql(self, connection, lookup, template_params, sql_params):


class OracleOperations(BaseSpatialOperations, DatabaseOperations):

name = "oracle"
oracle = True
disallowed_aggregates = (models.Collect, models.Extent3D, models.MakeLine)
Expand Down
16 changes: 9 additions & 7 deletions django/contrib/gis/db/backends/postgis/operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
class PostGISOperator(SpatialOperator):
def __init__(self, geography=False, raster=False, **kwargs):
# Only a subset of the operators and functions are available for the
# geography type.
# geography type. Lookups that don't support geography will be cast to
# geometry.
self.geography = geography
# Only a subset of the operators and functions are available for the
# raster type. Lookups that don't support raster will be converted to
Expand All @@ -37,13 +38,8 @@ def __init__(self, geography=False, raster=False, **kwargs):
super().__init__(**kwargs)

def as_sql(self, connection, lookup, template_params, *args):
if lookup.lhs.output_field.geography and not self.geography:
raise ValueError(
'PostGIS geography does not support the "%s" '
"function/operator." % (self.func or self.op,)
)

template_params = self.check_raster(lookup, template_params)
template_params = self.check_geography(lookup, template_params)
return super().as_sql(connection, lookup, template_params, *args)

def check_raster(self, lookup, template_params):
Expand Down Expand Up @@ -93,6 +89,12 @@ def check_raster(self, lookup, template_params):

return template_params

def check_geography(self, lookup, template_params):
"""Convert geography fields to geometry types, if necessary."""
if lookup.lhs.output_field.geography and not self.geography:
template_params["lhs"] += "::geometry"
return template_params


class ST_Polygon(Func):
function = "ST_Polygon"
Expand Down
1 change: 0 additions & 1 deletion django/contrib/gis/geos/geometry.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@


class GEOSGeometryBase(GEOSBase):

_GEOS_CLASSES = None

ptr_type = GEOM_PTR
Expand Down
8 changes: 6 additions & 2 deletions django/contrib/postgres/fields/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,9 @@ def __init__(self, index, base_field, *args, **kwargs):

def as_sql(self, compiler, connection):
lhs, params = compiler.compile(self.lhs)
return "%s[%%s]" % lhs, params + [self.index]
if not lhs.endswith("]"):
lhs = "(%s)" % lhs
return "%s[%%s]" % lhs, (*params, self.index)

@property
def output_field(self):
Expand All @@ -349,7 +351,9 @@ def __init__(self, start, end, *args, **kwargs):

def as_sql(self, compiler, connection):
lhs, params = compiler.compile(self.lhs)
return "%s[%%s:%%s]" % lhs, params + [self.start, self.end]
if not lhs.endswith("]"):
lhs = "(%s)" % lhs
return "%s[%%s:%%s]" % lhs, (*params, self.start, self.end)


class SliceTransformFactory:
Expand Down
1 change: 0 additions & 1 deletion django/contrib/redirects/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("sites", "0001_initial"),
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@


class Migration(migrations.Migration):

dependencies = [
("redirects", "0001_initial"),
]
Expand Down
1 change: 0 additions & 1 deletion django/contrib/sessions/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class Migration(migrations.Migration):

dependencies = []

operations = [
Expand Down
2 changes: 0 additions & 2 deletions django/contrib/sitemaps/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ def index(
content_type="application/xml",
sitemap_url_name="django.contrib.sitemaps.views.sitemap",
):

req_protocol = request.scheme
req_site = get_current_site(request)

Expand Down Expand Up @@ -97,7 +96,6 @@ def sitemap(
template_name="sitemap.xml",
content_type="application/xml",
):

req_protocol = request.scheme
req_site = get_current_site(request)

Expand Down
1 change: 0 additions & 1 deletion django/contrib/sites/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@


class Migration(migrations.Migration):

dependencies = []

operations = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


class Migration(migrations.Migration):

dependencies = [
("sites", "0001_initial"),
]
Expand Down
1 change: 0 additions & 1 deletion django/contrib/sites/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,6 @@ def get_by_natural_key(self, domain):


class Site(models.Model):

domain = models.CharField(
_("domain name"),
max_length=100,
Expand Down

0 comments on commit f583056

Please sign in to comment.