Skip to content
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

Upgrade to Django 5.1 #3775

Merged
merged 5 commits into from
Oct 9, 2024
Merged
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
874 changes: 440 additions & 434 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package-mode = false

[tool.poetry.dependencies]
python = "^3.11"
Django = "5.0.7"
Django = "5.1"
django-localflavor = "4.0"
djangorestframework = "3.15.2"
django-ical = "1.9.2"
Expand Down
4 changes: 3 additions & 1 deletion website/newsletters/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ def save_to_disk(newsletter):
html_message = html_template.render(context)
html_message = embed_linked_html_images(html_message)

newsletter.rendered_file = ContentFile(html_message.encode("utf-8"))
newsletter.rendered_file = ContentFile(
html_message.encode("utf-8"), name="newsletter.html"
)
newsletter.save()


Expand Down
22 changes: 11 additions & 11 deletions website/payments/tests/test_admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@ def test_get_tpay_allowed(self, tpay_allowed):
self.assertTrue(self.admin.get_tpay_allowed(self.user))

def test_get_queryset(self):
self.assertQuerysetEqual(
self.assertQuerySetEqual(
self.admin.get_queryset(None).all(),
PaymentUser.objects.all(),
ordered=False,
Expand All @@ -987,7 +987,7 @@ def test_tpay_allowed_filter(self):
filter_all = admin.ThaliaPayAllowedFilter(
None, {}, PaymentUser, admin.PaymentUserAdmin
)
self.assertQuerysetEqual(
self.assertQuerySetEqual(
filter_all.queryset(
None, PaymentUser.objects.select_properties("tpay_allowed")
),
Expand All @@ -998,7 +998,7 @@ def test_tpay_allowed_filter(self):
filter_true = admin.ThaliaPayAllowedFilter(
None, {"tpay_allowed": "1"}, PaymentUser, admin.PaymentUserAdmin
)
self.assertQuerysetEqual(
self.assertQuerySetEqual(
filter_true.queryset(
None, PaymentUser.objects.select_properties("tpay_allowed")
)
Expand All @@ -1010,7 +1010,7 @@ def test_tpay_allowed_filter(self):
filter_false = admin.ThaliaPayAllowedFilter(
None, {"tpay_allowed": "0"}, PaymentUser, admin.PaymentUserAdmin
)
self.assertQuerysetEqual(
self.assertQuerySetEqual(
filter_false.queryset(
None, PaymentUser.objects.select_properties("tpay_allowed")
)
Expand All @@ -1031,7 +1031,7 @@ def test_tpay_enabled_filter(self):
filter_true = admin.ThaliaPayEnabledFilter(
None, {"tpay_enabled": "1"}, PaymentUser, admin.PaymentUserAdmin
)
self.assertQuerysetEqual(
self.assertQuerySetEqual(
filter_true.queryset(None, PaymentUser.objects)
.values_list("pk", flat=True)
.all(),
Expand All @@ -1041,7 +1041,7 @@ def test_tpay_enabled_filter(self):
filter_false = admin.ThaliaPayEnabledFilter(
None, {"tpay_enabled": "0"}, PaymentUser, admin.PaymentUserAdmin
)
self.assertQuerysetEqual(
self.assertQuerySetEqual(
filter_false.queryset(None, PaymentUser.objects)
.values_list("pk", flat=True)
.all(),
Expand All @@ -1053,7 +1053,7 @@ def test_tpay_balance_filter(self):
filter_all = admin.ThaliaPayBalanceFilter(
None, {}, PaymentUser, admin.PaymentUserAdmin
)
self.assertQuerysetEqual(
self.assertQuerySetEqual(
filter_all.queryset(
None, PaymentUser.objects.select_properties("tpay_balance")
),
Expand All @@ -1064,7 +1064,7 @@ def test_tpay_balance_filter(self):
filter_true = admin.ThaliaPayBalanceFilter(
None, {"tpay_balance": "0"}, PaymentUser, admin.PaymentUserAdmin
)
self.assertQuerysetEqual(
self.assertQuerySetEqual(
filter_true.queryset(
None, PaymentUser.objects.select_properties("tpay_balance")
)
Expand All @@ -1076,7 +1076,7 @@ def test_tpay_balance_filter(self):
filter_false = admin.ThaliaPayBalanceFilter(
None, {"tpay_balance": "1"}, PaymentUser, admin.PaymentUserAdmin
)
self.assertQuerysetEqual(
self.assertQuerySetEqual(
filter_false.queryset(
None, PaymentUser.objects.select_properties("tpay_balance")
)
Expand All @@ -1088,7 +1088,7 @@ def test_tpay_balance_filter(self):
filter_true = admin.ThaliaPayBalanceFilter(
None, {"tpay_balance": "0"}, PaymentUser, admin.PaymentUserAdmin
)
self.assertQuerysetEqual(
self.assertQuerySetEqual(
filter_true.queryset(
None, PaymentUser.objects.select_properties("tpay_balance")
)
Expand All @@ -1100,7 +1100,7 @@ def test_tpay_balance_filter(self):
filter_false = admin.ThaliaPayBalanceFilter(
None, {"tpay_balance": "1"}, PaymentUser, admin.PaymentUserAdmin
)
self.assertQuerysetEqual(
self.assertQuerySetEqual(
filter_false.queryset(
None, PaymentUser.objects.select_properties("tpay_balance")
)
Expand Down
6 changes: 3 additions & 3 deletions website/thaliawebsite/templates/paginated_page.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@
<ul class="pagination mt-4">
{% if page_obj.has_previous %}
<li class="page-item">
<a class="page-link" href="{{ base_url }}page={{ page_obj.previous_page_number }}">
<a class="page-link" href="{% querystring page=page_obj.previous_page_number %}">
<span aria-hidden="true">&laquo;</span>
<span class="sr-only">Previous</span>
</a>
</li>
{% endif %}
{% for page in page_range %}
<li class="page-item{% if page == page_obj.number %} active{% endif %}">
<a class="page-link" href="{{ base_url }}page={{ page }}">{{ page }}
<a class="page-link" href="{% querystring page=page %}">{{ page }}
</a>
</li>
{% endfor %}
{% if page_obj.has_next %}
<li class="page-item">
<a class="page-link" href="{{ base_url }}page={{ page_obj.next_page_number }}">
<a class="page-link" href="{% querystring page=page_obj.next_page_number%}">
<span aria-hidden="true">&raquo;</span>
<span class="sr-only">Next</span>
</a>
Expand Down
10 changes: 0 additions & 10 deletions website/thaliawebsite/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,19 +52,9 @@ def get_context_data(self, **kwargs) -> dict:

page_range = range(page_range_start, page_range_stop)

querydict = self.request.GET.copy()

if "page" in querydict:
del querydict["page"]

context.update(
{
"page_range": page_range,
"base_url": (
f"{self.request.path}?{querydict.urlencode()}&"
if querydict
else f"{self.request.path}?"
),
}
)

Expand Down
4 changes: 2 additions & 2 deletions website/utils/media/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
from django.core import signing
from django.core.cache import cache
from django.core.exceptions import PermissionDenied
from django.core.files.storage import get_storage_class
from django.core.signing import BadSignature
from django.http import Http404
from django.shortcuts import redirect
from django.utils import timezone
from django.utils.module_loading import import_string

from django_sendfile import sendfile

Expand Down Expand Up @@ -46,7 +46,7 @@ def private_media(request, request_path):
# Get image information from signature
# raises PermissionDenied if bad signature
sig_info = _get_signature_info(request)
storage = get_storage_class(sig_info["storage"])()
storage = import_string(sig_info["storage"])()
serve_path = sig_info["serve_path"]

if not storage.exists(serve_path) or not serve_path == request_path:
Expand Down