Skip to content

Commit

Permalink
🤝 Upgrade to Django 5.0 (#1105)
Browse files Browse the repository at this point in the history
* Upgrade to Django 5.0

* Update requirements file

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
saadmk11 and pre-commit-ci[bot] committed Feb 23, 2024
1 parent d4c1b8d commit 028ec0d
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ repos:
rev: 1.16.0
hooks:
- id: django-upgrade
args: [--target-version, "4.2"]
args: [--target-version, "5.0"]
alias: autoformat
- repo: https://github.com/asottile/blacken-docs
rev: 1.16.0
Expand Down
8 changes: 4 additions & 4 deletions grid/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class Meta:
template_name = "django_tables2/bootstrap.html"

def render_description(self, value, record):
return format_html(emojize(record.description))
return format_html("{}", emojize(record.description))

def render_title(self, value, record):
return format_html(
'<a href="{}">{}</a>'.format(
reverse("grid", kwargs={"slug": record.slug}), emojize(record.title)
)
'<a href="{}">{}</a>',
reverse("grid", kwargs={"slug": record.slug}),
emojize(record.title),
)
11 changes: 5 additions & 6 deletions package/tables.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from django.contrib.humanize.templatetags.humanize import intcomma
from django.urls import reverse
from django.utils.html import format_html
from django.utils.safestring import mark_safe

from django_tables2 import Column, Table, TemplateColumn
from emoji import emojize

Expand All @@ -17,13 +18,11 @@ class PackageTable(Table):
version = Column(accessor="pypi_version", orderable=False, verbose_name="Version")
repo_watchers = Column(
accessor="repo_watchers",
verbose_name=format_html(
"Stars <span class='glyphicon glyphicon-star'></span>"
),
verbose_name=mark_safe("Stars <span class='glyphicon glyphicon-star'></span>"),
)
repo_forks = Column(
accessor="repo_forks",
verbose_name=format_html(
verbose_name=mark_safe(
"Forks <span class='glyphicon glyphicon-random'></span>"
),
)
Expand Down Expand Up @@ -60,7 +59,7 @@ def render_repo_forks(self, value, record):
return intcomma(record.repo_forks)

def render_title(self, value, record):
return format_html(
return mark_safe(
'<a href="{}">{}</a>'.format(
reverse("package", kwargs={"slug": record.slug}), emojize(record.title)
)
Expand Down
2 changes: 1 addition & 1 deletion requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ django-secure
django-structlog
django-tables2
django-waffle
Django<5.0
Django<5.2
djangorestframework<3.15
emoji
emojificate
Expand Down
11 changes: 4 additions & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,7 @@ coverage[toml]==7.4.1 \
--hash=sha256:f86f368e1c7ce897bf2457b9eb61169a44e2ef797099fb5728482b8d69f3f016 \
--hash=sha256:f90515974b39f4dea2f27c0959688621b46d96d5a626cf9c53dbc653a895c05c \
--hash=sha256:fe558371c1bdf3b8fa03e097c523fb9645b8730399c14fe7721ee9c9e2a545d3
# via
# coverage
# pytest-cov
# via pytest-cov
crispy-bootstrap3==2024.1 \
--hash=sha256:257555c61ec6cd792e8654822e836794237465442a6e4b47ed31f7464e8c10f4 \
--hash=sha256:343c696ae1a854ac0ccad25e9e7d782400783034220a11aa179d1d799acf6161
Expand Down Expand Up @@ -349,9 +347,9 @@ distro==1.9.0 \
--hash=sha256:2fa77c6fd8940f116ee1d6b94a2f90b13b5ea8d019b98bc8bafdcabcdd9bdbed \
--hash=sha256:7bffd925d65168f85027d8da9af6bddab658135b840670a223589bc0c8ef02b2
# via openai
django==4.2.10 \
--hash=sha256:a2d4c4d4ea0b6f0895acde632071aff6400bfc331228fc978b05452a0ff3e9f1 \
--hash=sha256:b1260ed381b10a11753c73444408e19869f3241fc45c985cd55a30177c789d13
django==5.0.2 \
--hash=sha256:56ab63a105e8bb06ee67381d7b65fe6774f057e41a8bab06c8020c8882d8ecd4 \
--hash=sha256:b5bb1d11b2518a5f91372a282f24662f58f66749666b0a286ab057029f728080
# via
# -r requirements.in
# crispy-bootstrap3
Expand Down Expand Up @@ -1029,7 +1027,6 @@ pyjwt[crypto]==2.8.0 \
# via
# github3-py
# pygithub
# pyjwt
# social-auth-core
pymdown-extensions==10.7 \
--hash=sha256:6ca215bc57bc12bf32b414887a68b810637d039124ed9b2e5bd3325cbb2c050c \
Expand Down
6 changes: 3 additions & 3 deletions settings/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@
# to load the internationalization machinery.
USE_I18N = True

# RemovedInDjango50Warning: The default value of USE_TZ will change from
# False to True in Django 5.0. Set USE_TZ to False in your project
# settings if you want to keep the current default behavior.
USE_TZ = False

# Absolute path to the directory that holds media.
Expand Down Expand Up @@ -169,6 +166,9 @@

INSTALLED_APPS = PREREQ_APPS + PROJECT_APPS

# Set the default scheme for forms.URLField to "https"
# TODO: Remove transitional setting in Django 6.0
FORMS_URLFIELD_ASSUME_HTTPS = True

MESSAGE_STORAGE = "django.contrib.messages.storage.session.SessionStorage"

Expand Down

0 comments on commit 028ec0d

Please sign in to comment.