Skip to content

Commit 7c76777

Browse files
deps: update to django5 (#6452)
1 parent 0f8166d commit 7c76777

30 files changed

Lines changed: 220 additions & 215 deletions

File tree

api/app/settings/test.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,5 +66,3 @@
6666
"""
6767

6868
ENABLE_POSTPONE_DECORATOR = False
69-
70-
DEBUG = True

api/app/urls.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
),
5050
]
5151

52-
if settings.DEBUG:
52+
if settings.DEBUG: # pragma: no cover
5353
urlpatterns = [
5454
re_path(r"^__debug__/", include("debug_toolbar.urls")),
5555
] + urlpatterns
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Generated by Django 5.2.9 on 2025-12-31 15:34
2+
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("app_analytics", "0006_add_labels"),
10+
]
11+
12+
operations = [
13+
migrations.RenameIndex(
14+
model_name="apiusageraw",
15+
new_name="app_analyti_environ_b61cad_idx",
16+
old_fields=("environment_id", "created_at"),
17+
),
18+
]

api/app_analytics/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class APIUsageRaw(models.Model):
6262
labels = HStoreField(default=dict)
6363

6464
class Meta:
65-
index_together = (("environment_id", "created_at"),)
65+
indexes = [models.Index(fields=["environment_id", "created_at"])]
6666

6767

6868
class AbstractBucket(LifecycleModelMixin, models.Model): # type: ignore[misc]

api/audit/views.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ def _get_organisation(self) -> Organisation | None:
108108
109109
Since we're applying the base filters to the query set
110110
"""
111-
return (
111+
return ( # type: ignore[no-any-return]
112112
self.request.user.organisations.filter( # type: ignore[union-attr]
113113
userorganisation__role=OrganisationRole.ADMIN
114114
)

api/custom_auth/mfa/trench/command/remove_backup_code.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ def remove_backup_code_command(user_id: Any, method_name: str, code: str) -> Non
1111
.values_list("_backup_codes", flat=True)
1212
.first()
1313
)
14+
if serialized_codes is None: # pragma: no cover
15+
return
1416
codes = MFAMethod._BACKUP_CODES_DELIMITER.join(
1517
_remove_code_from_set( # type: ignore[arg-type]
1618
backup_codes=set(serialized_codes.split(MFAMethod._BACKUP_CODES_DELIMITER)),

api/custom_auth/mfa/trench/views/base.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ def post(request: Request, method: str) -> Response:
3838
try:
3939
user = request.user
4040
mfa = create_mfa_method_command(
41-
user_id=user.id,
41+
user_id=user.id, # type: ignore[arg-type]
4242
name=method,
4343
)
4444
except MFAValidationError as cause:
@@ -57,7 +57,7 @@ def post(request: Request, method: str) -> Response:
5757
if not serializer.is_valid():
5858
return Response(status=HTTP_400_BAD_REQUEST, data=serializer.errors)
5959
backup_codes = activate_mfa_method_command(
60-
user_id=request.user.id,
60+
user_id=request.user.id, # type: ignore[arg-type]
6161
name=method,
6262
code=serializer.validated_data["code"],
6363
)
@@ -71,7 +71,8 @@ class MFAMethodDeactivationView(APIView):
7171
def post(request: Request, method: str) -> Response:
7272
try:
7373
deactivate_mfa_method_command(
74-
mfa_method_name=method, user_id=request.user.id
74+
mfa_method_name=method,
75+
user_id=request.user.id, # type: ignore[arg-type]
7576
)
7677
return Response(status=HTTP_204_NO_CONTENT)
7778
except MFAValidationError as cause:

api/environments/identities/managers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def with_context(
3434
self,
3535
integrations: "Iterable[IntegrationConfig] | None" = None,
3636
extra_select_related: "Iterable[str] | None" = None,
37-
extra_prefetch_related: "Iterable[str | Prefetch] | None" = None,
37+
extra_prefetch_related: "Iterable[str | Prefetch] | None" = None, # type: ignore[type-arg]
3838
) -> "QuerySet[Identity]":
3939
from integrations.integration import IDENTITY_INTEGRATIONS
4040

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Generated by Django 5.2.9 on 2025-12-31 15:29
2+
from common.migrations.helpers import PostgresOnlyRunSQL
3+
from django.db import migrations
4+
5+
6+
class Migration(migrations.Migration):
7+
8+
dependencies = [
9+
("identities", "0005_revert_sanitized_identifiers"),
10+
]
11+
12+
operations = [
13+
migrations.SeparateDatabaseAndState(
14+
state_operations=[
15+
migrations.RenameIndex(
16+
model_name="identity",
17+
new_name="environment_environ_341dc9_idx",
18+
old_fields=("environment", "created_date"),
19+
),
20+
],
21+
database_operations=[
22+
PostgresOnlyRunSQL(
23+
'ALTER INDEX "environments_identity_environment_id_created_date_idx" RENAME TO "environment_environ_341dc9_idx"',
24+
reverse_sql='ALTER INDEX "environment_environ_341dc9_idx" RENAME TO "environments_identity_environment_id_created_date_idx"'
25+
)
26+
],
27+
)
28+
]

api/environments/identities/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Meta:
3939
# Note that the environment / created_date index is added only to postgres, so we can add it concurrently to
4040
# avoid any downtime. If people using MySQL / Oracle have issues with poor performance on the identities table,
4141
# we can provide them the SQL to add it manually in a small window of downtime.
42-
index_together = (("environment", "created_date"),)
42+
indexes = [models.Index(fields=["environment", "created_date"])]
4343

4444
def natural_key(self): # type: ignore[no-untyped-def]
4545
return self.identifier, self.environment.api_key

0 commit comments

Comments
 (0)