-
Notifications
You must be signed in to change notification settings - Fork 185
Add Django 5.2 support and compatibility fixes #4646
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
a658ff2
06768d1
77f6115
dde7472
a14d50e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -186,7 +186,7 @@ def ensure_external_key_uniqueness__curriculum(sender, instance, **kwargs): # p | |
| course_runs = CourseRun.objects.filter( | ||
| course__degree_course_curricula=instance, | ||
| external_key__isnull=False | ||
| ).iterator() | ||
| ).iterator(chunk_size=settings.ITERATOR_CHUNK_SIZE) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In Django 5.0, QuerySet.iterator() requires an explicit chunk_size, especially when using prefetches. I set it to 2000 to match the previous default value used in earlier versions. Release Notes 5.0 |
||
| check_curricula_and_related_programs_for_duplicate_external_key([instance], course_runs) | ||
|
|
||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,6 +3,7 @@ | |
| import ddt | ||
| import pytest | ||
| from bs4 import BeautifulSoup | ||
| from django import VERSION as DJANGO_VERSION | ||
| from django.contrib.admin.sites import AdminSite | ||
| from django.contrib.contenttypes.models import ContentType | ||
| from django.http import HttpRequest | ||
|
|
@@ -485,7 +486,8 @@ def test_queryset_method_returns_eligible_programs(self): | |
| """ Verify that one click purchase eligible programs pass the filter. """ | ||
| verified_seat_type = factories.SeatTypeFactory.verified() | ||
| program_type = factories.ProgramTypeFactory(applicable_seat_types=[verified_seat_type]) | ||
| program_filter = ProgramEligibilityFilter(None, {self.parameter_name: 1}, None, None) | ||
| value = [1] if DJANGO_VERSION >= (5, 2) else 1 | ||
| program_filter = ProgramEligibilityFilter(None, {self.parameter_name: value}, None, None) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Django 5.0+ returns a tuple from SimpleListFilter.value(), even for single values. |
||
| course_run = factories.CourseRunFactory(end=None, enrollment_end=None,) | ||
| factories.SeatFactory(course_run=course_run, type=verified_seat_type, upgrade_deadline=None) | ||
| one_click_purchase_eligible_program = factories.ProgramFactory( | ||
|
|
@@ -498,7 +500,8 @@ def test_queryset_method_returns_eligible_programs(self): | |
|
|
||
| def test_queryset_method_returns_ineligible_programs(self): | ||
| """ Verify programs ineligible for one-click purchase do not pass the filter. """ | ||
| program_filter = ProgramEligibilityFilter(None, {self.parameter_name: 0}, None, None) | ||
| value = [0] if DJANGO_VERSION >= (5, 2) else 0 | ||
| program_filter = ProgramEligibilityFilter(None, {self.parameter_name: value}, None, None) | ||
| one_click_purchase_ineligible_program = factories.ProgramFactory(one_click_purchase_enabled=False) | ||
| with self.assertNumQueries(4): | ||
| assert list(program_filter.queryset({}, Program.objects.all())) == [one_click_purchase_ineligible_program] | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
queryset_pagination was in Meta, which is ignored by django-elasticsearch-dsl. Moved it to the Django class as per the documentation.