Skip to content

Conversation

@hugovk
Copy link
Member

@hugovk hugovk commented Nov 22, 2025

Description

django-upgrade upgrades Django code, which can help update deprecations to make upgrading to the next LTS easier.

Also add it to .pre-commit-config.yaml with some other linters, and run it on GitHub Actions.

We can also add things like Ruff formatting/linting to .pre-commit-config.yaml later: #2540

@hugovk hugovk added the tests Relates to the test suite label Nov 22, 2025
rev: 1.29.1
hooks:
- id: django-upgrade
args: [--target-version=4.2]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tool looks for the Django version in pyproject.toml. We don't have one, so defaults to 2.2. So let's specify it here, and remember to update when also bumping the Django version in base-requirements.txt.

https://django-upgrade.readthedocs.io/en/latest/options.html#cmdoption-target-version

Comment on lines +33 to +34
ci:
autoupdate_schedule: quarterly
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case we want to enable https://pre-commit.ci/ ? Be less spammy than the default weekly.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-commit.ci would also replace your github action and run faster. It's quite optimized

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's also useful to have it in GitHub Actions, to be able to already catch things in forks.

re_path(r'^funding.json$', views.serve_funding_json, name='funding_json'),
path('humans.txt', TemplateView.as_view(template_name='humans.txt', content_type='text/plain')),
path('robots.txt', TemplateView.as_view(template_name='robots.txt', content_type='text/plain')),
path('funding.json', views.serve_funding_json, name='funding_json'),
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return {'slug': ['name']}
return {}

@admin.display(description="Revenue split")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

featured_stories = Story.objects.featured()
expected_repr = [f'<Story: {self.story3.name}>']
self.assertQuerysetEqual(featured_stories, expected_repr, transform=repr)
self.assertQuerySetEqual(featured_stories, expected_repr, transform=repr)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

tests Relates to the test suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants