Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions courses/migrations/0022_programrequirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,17 @@ class Migration(migrations.Migration):
name="courses_programrequirement_root_uniq",
),
),
migrations.AlterIndexTogether(
name="programrequirement",
index_together={("program", "course"), ("course", "program")},
# Changed to use named indexes for Django 5 compatibility
migrations.AddIndex(
model_name="programrequirement",
index=models.Index(
fields=["program", "course"], name="courses_pro_program_temp_idx"
),
),
migrations.AddIndex(
model_name="programrequirement",
index=models.Index(
fields=["course", "program"], name="courses_pro_course__temp_idx"
),
),
]
27 changes: 20 additions & 7 deletions courses/migrations/0055_rename_programrequirement_index.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by Django 4.2 on 2024-09-10 17:28
# Modified for Django 5.2 compatibility

from django.db import migrations
from django.db import migrations, models


class Migration(migrations.Migration):
Expand All @@ -9,14 +10,26 @@ class Migration(migrations.Migration):
]

operations = [
migrations.RenameIndex(
# Remove temporary indexes from migration 0022
migrations.RemoveIndex(
model_name="programrequirement",
new_name="courses_pro_course__fdcdb6_idx",
old_fields=("course", "program"),
name="courses_pro_program_temp_idx",
),
migrations.RenameIndex(
migrations.RemoveIndex(
model_name="programrequirement",
new_name="courses_pro_program_c8ff7c_idx",
old_fields=("program", "course"),
name="courses_pro_course__temp_idx",
),
# Add properly named indexes
migrations.AddIndex(
model_name="programrequirement",
index=models.Index(
fields=["course", "program"], name="courses_pro_course__fdcdb6_idx"
),
),
migrations.AddIndex(
model_name="programrequirement",
index=models.Index(
fields=["program", "course"], name="courses_pro_program_c8ff7c_idx"
),
),
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Generated by Django 4.2.22 on 2025-07-02 18:33
# Modified for Django 5.2 compatibility

from django.db import migrations
from django.db import migrations, models


class Migration(migrations.Migration):
Expand All @@ -9,18 +10,24 @@ class Migration(migrations.Migration):
]

operations = [
migrations.RenameIndex(
model_name="programrequirement",
new_name="courses_pro_program_18e9ef_idx",
old_fields=("program", "required_program"),
),
migrations.RenameIndex(
model_name="programrequirement",
new_name="courses_pro_require_99b956_idx",
old_fields=("required_program", "program"),
),
# Remove the old index_together setting
migrations.AlterIndexTogether(
name="programrequirement",
index_together=set(),
),
# Add named indexes explicitly
migrations.AddIndex(
model_name="programrequirement",
index=models.Index(
fields=["program", "required_program"],
name="courses_pro_program_18e9ef_idx",
),
),
migrations.AddIndex(
model_name="programrequirement",
index=models.Index(
fields=["required_program", "program"],
name="courses_pro_require_99b956_idx",
),
),
]
23 changes: 18 additions & 5 deletions courses/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1996,11 +1996,24 @@ class Meta:
),
)
indexes = [
models.Index(fields=("program", "course")),
models.Index(fields=("course", "program")),
models.Index(fields=("program", "required_program")),
models.Index(fields=("required_program", "program")),
models.Index(fields=("program", "node_type", "depth")),
models.Index(
fields=["program", "course"], name="courses_pro_program_c8ff7c_idx"
),
models.Index(
fields=["course", "program"], name="courses_pro_course__fdcdb6_idx"
),
models.Index(
fields=["program", "required_program"],
name="courses_pro_program_18e9ef_idx",
),
models.Index(
fields=["required_program", "program"],
name="courses_pro_require_99b956_idx",
),
models.Index(
fields=["program", "node_type", "depth"],
name="courses_pro_program_4f3727_idx",
),
]


Expand Down
7 changes: 4 additions & 3 deletions ecommerce/migrations/0022_backfill_reference_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from django.conf import settings
from django.db import migrations
from django.db.models import F, Value
from django.db.models.functions import Concat
from django.db.models import CharField, F, Value
from django.db.models.functions import Cast, Concat

from ecommerce.constants import REFERENCE_NUMBER_PREFIX

Expand All @@ -15,7 +15,8 @@ def backfill_order_reference_number(apps, schema_editor):
Value(REFERENCE_NUMBER_PREFIX),
Value(settings.ENVIRONMENT),
Value("-"),
F("id"),
Cast(F("id"), CharField()),
output_field=CharField(),
)
)

Expand Down
1 change: 1 addition & 0 deletions main/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,6 +1151,7 @@
OAUTH2_PROVIDER_REFRESH_TOKEN_MODEL = "oauth2_provider.RefreshToken" # noqa: S105

OAUTH2_PROVIDER = {
"PKCE_REQUIRED": False,
"OIDC_ENABLED": True,
"OIDC_RSA_PRIVATE_KEY": get_string(
name="OIDC_RSA_PRIVATE_KEY",
Expand Down
35 changes: 19 additions & 16 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ celery-redbeat = "^2.0.0"
click = ">=8.1,!=8.2.0"
deepdiff = "^8.0.0"
dj-database-url = "^0.5.0"
django = "4.2.25"
django = "5.2.1"
django-anymail = {extras = ["mailgun"], version = "^11.1"}
django-cors-headers = "^4.0.0"
django-countries = "^7.2.1"
django-filter = "^24.3"
django-health-check = { git = "https://github.com/revsys/django-health-check", rev="53f9bdc3a7acc8a577319987fef0bd3040eef4b4" } # pragma: allowlist secret
django-hijack = "^3.6.0"
django-ipware = "^7.0.0"
django-oauth-toolkit = "^1.7.0"
django-oauth-toolkit = "^3.1.0"
django-redis = "^5.0.0"
django-reversion = "^5.1.0"
django-robots = "6.1"
Expand All @@ -38,7 +38,7 @@ django-treebeard = "^4.5.1"
django-user-agents = "^0.4.0"
django-viewflow = "^2.2.7"
django-webpack-loader = "^3.0.0"
djangorestframework = "^3.12.4"
djangorestframework = "^3.16.1"
djoser = "^2.1.0"
drf-extensions = "^0.8.0"
drf-spectacular = "^0.28.0"
Expand Down
2 changes: 2 additions & 0 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ env =
CELERY_TASK_ALWAYS_EAGER=True
DEBUG=False
DJANGO_SETTINGS_MODULE=main.settings
SECRET_KEY=test-secret-key-for-testing
[email protected]
GOOGLE_DOMAIN_VERIFICATION_TAG_VALUE=
KEYCLOAK_BASE_URL=http://keycloak/
KEYCLOAK_REALM_NAME=ol-test
Expand Down
10 changes: 6 additions & 4 deletions users/views_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@ def test_cannot_create_user(client):
assert resp.status_code == status.HTTP_404_NOT_FOUND


def test_cannot_update_user(user_client, user):
"""Verify the api to update a user is doesn't accept the verb"""
resp = user_client.patch(
reverse("users_api-detail", kwargs={"pk": user.id}), data={"name": "Name"}
def test_cannot_update_user(staff_client, user):
"""Verify the api to update a user doesn't accept the verb"""
resp = staff_client.patch(
reverse("users_api-detail", kwargs={"pk": user.id}),
data={"name": "Name"},
content_type="application/json",
)

assert resp.status_code == status.HTTP_405_METHOD_NOT_ALLOWED
Expand Down
Loading