Skip to content

Upgrade Django to versions 4.2.30, 5.2.13, and finally 6.0.4#65

Open
OMikkel wants to merge 16 commits intomasterfrom
chore/upgrade-python
Open

Upgrade Django to versions 4.2.30, 5.2.13, and finally 6.0.4#65
OMikkel wants to merge 16 commits intomasterfrom
chore/upgrade-python

Conversation

@OMikkel
Copy link
Copy Markdown
Contributor

@OMikkel OMikkel commented Apr 17, 2026

This pull request includes several important updates to dependencies and configuration, as well as code and template changes to support these updates. The main themes are migrating from bootstrap5 to django_bootstrap5, switching the CAPTCHA integration from captcha to django_recaptcha, updating the PostgreSQL version in Docker, and improving static files handling. Additionally, there are minor improvements to password generation and form button markup.

Dependency and Configuration Updates

  • Migrated from bootstrap5 to django_bootstrap5 throughout the project, updating all template {% load %} statements and the installed apps in settings/base.py. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10] [11] [12]
  • Replaced captcha with django_recaptcha in both dependencies and imports, including updating form fields and silenced system checks. [1] [2] [3]
  • Upgraded the PostgreSQL Docker image from version 12 to 18 in docker-compose.yml.
  • Updated static files storage configuration to use the new STORAGES setting and whitenoise for static files.

Template and UI Improvements

  • Updated button markup in forms to use a consistent <div class="mt-3"> wrapper instead of {% buttons %} for better styling and clarity. [1] [2] [3] [4] [5]
  • Removed the now-unnecessary bootstrap5 configuration from settings.

Build and Development Workflow

  • Improved the Makefile by adding a collectstatic command, ensuring static files are collected before running the server, and renamed download-media to import-media for clarity. [1] [2] [3]
  • Updated .dockerignore to exclude the /temp_media_tmp directory.

Code Improvements

  • Improved password generation for admin users by using secrets.token_urlsafe for better security. [1] [2]

Other Minor Changes

  • Added is_composite_pk to the Meta class in fredagscafeen/admin_view.py.
  • Cleaned up timezone and localization settings in settings/base.py.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR modernizes the project for newer Django versions by updating core dependencies and aligning settings, templates, and form integrations (Bootstrap + reCAPTCHA), along with some dev workflow tweaks.

Changes:

  • Upgrade Django and related dependencies; switch bootstrap5django_bootstrap5 and captchadjango_recaptcha.
  • Update static files configuration to Django’s newer STORAGES setting (with WhiteNoise).
  • Adjust templates/tests/commands for new dependencies and timezone handling; minor Makefile workflow updates.

Reviewed changes

Copilot reviewed 43 out of 45 changed files in this pull request and generated 9 comments.

Show a summary per file
File Description
web/templates/login.html Switch template tag load to django_bootstrap5 and adjust submit button markup.
web/templates/base.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
web/templates/about.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
web/forms.py Switch ReCAPTCHA field import to django_recaptcha.
udlejning/tests.py Replace pytz usage with stdlib datetime.timezone.utc.
udlejning/templates/udlejningTent.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
udlejning/templates/udlejningSpeakers.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
udlejning/templates/udlejningProjector.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
udlejning/templates/udlejningGrill.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
udlejning/templates/udlejningBoardGameCart.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
udlejning/templates/udlejning.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %} and update submit button markup.
udlejning/forms.py Switch ReCAPTCHA field import to django_recaptcha.
requirements.txt Regenerated lockfile with upgraded Django/deps; switches to django-bootstrap5, django-recaptcha, psycopg, etc.
requirements.in Update top-level dependency constraints for the new Django/dependency baseline.
mail/models.py Update CheckConstraint kwarg name.
mail/migrations/0006_forwardedmail_previous_attempt_integrity.py Update CheckConstraint kwarg name in migration.
items/templates/items.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
items/management/commands/import_inventory.py Switch datetime parsing/timezone handling to stdlib timezone/timedelta.
guides/templates/guides.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
gallery/tests.py Adjust media test file creation to in-memory uploads; change MEDIA_ROOT override.
gallery/templates/image.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
gallery/templates/gallery.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
gallery/templates/album.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
fredagscafeen/settings/local.py Update silenced system check to django_recaptcha identifier.
fredagscafeen/settings/htlm5.py Move static storage configuration to STORAGES with WhiteNoise backend.
fredagscafeen/settings/base.py Swap installed apps to django_bootstrap5/django_recaptcha; remove legacy bootstrap settings and old i18n/tz flags.
fredagscafeen/admin_view.py Add is_composite_pk attribute on Meta shim for newer Django expectations.
events/templates/events.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
events/templates/event.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %} and update submit button markup.
events/templates/common-events.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
docker-compose.yml Bump Postgres image major version.
bartenders/templates/index.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %} and update submit button markup.
bartenders/templates/board.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
bartenders/templates/bartender_info.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %} and update submit button markup.
bartenders/templates/barplan.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
bartenders/templates/ballots_update.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %} and update submit button markup.
bartenders/templates/ballots.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
bartenders/forms.py Switch ReCAPTCHA field import to django_recaptcha.
bartenders/admin.py Improve admin-user password generation using secrets.
bartab/templates/bartab.html Replace {% load bootstrap5 %} with {% load django_bootstrap5 %}.
Makefile Add collectstatic target; run collectstatic before run; rename download-media target.
.gitignore Add ignore entry for temp media dir.
.dockerignore Add ignore entry for temp media dir.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread gallery/tests.py
Comment thread gallery/tests.py Outdated
Comment thread .dockerignore Outdated
Comment thread Makefile
Comment thread requirements.in
Comment thread mail/models.py
Comment thread items/management/commands/import_inventory.py Outdated
Comment thread mail/migrations/0006_forwardedmail_previous_attempt_integrity.py
Comment thread udlejning/tests.py
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 49 out of 51 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread items/management/commands/import_inventory.py
Comment thread items/management/commands/import_inventory.py Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 50 out of 51 changed files in this pull request and generated 3 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread items/management/commands/import_inventory.py Outdated
Comment thread gallery/tests.py Outdated
Comment thread docker-compose.yml
@OMikkel OMikkel marked this pull request as ready for review April 19, 2026 12:36
Copy link
Copy Markdown
Member

@AndersSeverinsen AndersSeverinsen left a comment

Choose a reason for hiding this comment

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

Det ser godt ud. Jeg håber ikke der kommer nogle seriøse fejl i PROD.

Check gerne mine små ændringer:

  • Jeg prøvede at lave et nyt galleri album, men den gav en fejl og havde noget mærkelig CSS på admin siden, som jeg fiksede.
  • Derudover, havde min docker desktop en warning med et LegacyKeyValueFormat.
  • Unused import Copilot havde kommenteret.

@OMikkel
Copy link
Copy Markdown
Contributor Author

OMikkel commented Apr 19, 2026

Der skulle gerne være styr på det. Jeg fandt en fejl med et custom CommaSeparatedEmailField der ikke ville fungere ordentligt, men det er fikset. Jeg har ikke kunne finde andre fejl end det.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants