Skip to content

[django] upgraded django to 4.1 #3945

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

Merged
merged 1 commit into from
Mar 11, 2025
Merged

Conversation

amitsrivastava
Copy link
Collaborator

Several other libraries have also been upgraded along with it. Three code changes had to be made.

  1. Django 4 wants the middlewares to be explicitly sync and async. Rather than rewriting all of the middleware classes, I took the shortcut of creating a new mixin class that supports only sync calls.

  2. CSRF_TRUSTED_ORIGINS in django 4+ need the scheme part as well. We now check and add http and https to the origins.

  3. django-babel also needs a change every time we do a django upgrade. This is mostly just changes around django version support.

There is also some change to our database support due to this. Following is the list of supported db versions.

  • PostgreSQL 11 and higher
  • MariaDB 10.3 and higher
  • MySQL 5.7 and higher
  • Oracle Database Server versions 19c and higher. Version 7.0 or higher of the cx_Oracle Python driver is required.

What changes were proposed in this pull request?

  • (Please fill in changes proposed in this fix)

How was this patch tested?

  • (Please explain how this patch was tested. Ex: unit tests, manual tests)
  • (If this patch involves UI changes, please attach a screen-shot; otherwise, remove this)

Please review Hue Contributing Guide before opening a pull request.

Copy link
Contributor

@ranade1 ranade1 left a comment

Choose a reason for hiding this comment

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

looks good.

@amitsrivastava amitsrivastava force-pushed the dev/amit/django-upgrade branch from b6ef65f to e1a6f9b Compare January 22, 2025 18:13
@amitsrivastava amitsrivastava force-pushed the dev/amit/django-upgrade branch 2 times, most recently from ac0a9dd to 1ab7b15 Compare February 5, 2025 20:54
Copy link
Collaborator

@Harshg999 Harshg999 left a comment

Choose a reason for hiding this comment

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

Added few review comments

@amitsrivastava amitsrivastava force-pushed the dev/amit/django-upgrade branch 5 times, most recently from a87ba3c to cb0f365 Compare March 6, 2025 17:52
Copy link

github-actions bot commented Mar 6, 2025

Backend Codecov

Backend Code Coverage Report •
FileStmtsMissCoverMissing
desktop/core/src/desktop
   middleware.py58624158%94–97, 99, 101–109, 111, 129, 134–142, 144, 159, 187, 190, 219–222, 250, 278, 303, 306–308, 311, 314–316, 319–324, 328–330, 332–334, 338–340, 343–348, 351–354, 356–357, 359–367, 370–373, 377–380, 385–386, 388–394, 406, 420, 423, 447–449, 477, 482–484, 486–487, 489–492, 511, 529, 532, 550, 559, 572–575, 578–583, 586, 589–592, 604, 607–609, 612–613, 620–627, 629–630, 635–638, 645–651, 694, 708, 716–717, 726–729, 733–736, 738, 740, 742–744, 747–748, 757, 765–767, 769–770, 787–797, 800–806, 813–819, 835–836, 864, 887, 897, 906–907, 919–920, 923–925, 928–931, 934–937, 939–941, 943, 947–948, 950, 953, 955, 968–969, 973
TOTAL533072613250% 

Pytest Report

Tests Skipped Failures Errors Time
1088 107 💤 0 ❌ 0 🔥 5m 57s ⏱️

@amitsrivastava amitsrivastava force-pushed the dev/amit/django-upgrade branch from cb0f365 to a77200e Compare March 10, 2025 18:34
Copy link

⚠️ No unit test files modified. Please ensure that changes are properly tested. ⚠️

Copy link

github-actions bot commented Mar 10, 2025

Backend Codecov

Backend Code Coverage Report •
FileStmtsMissCoverMissing
desktop/core/src/desktop
   middleware.py57323958%94–97, 99, 101–109, 111, 129, 134–142, 144, 159, 190–193, 221, 249, 274, 277–279, 282, 285–287, 290–295, 299–301, 303–305, 309–311, 314–319, 322–325, 327–328, 330–338, 341–344, 348–351, 356–357, 359–365, 377, 391, 394, 418–420, 448, 453–455, 457–458, 460–463, 482, 500, 503, 521, 530, 543–546, 549–554, 557, 560–563, 575, 578–580, 583–584, 591–598, 600–601, 606–609, 616–622, 665, 679, 687–688, 697–700, 704–707, 709, 711, 713–715, 718–719, 728, 736–738, 740–741, 758–768, 771–777, 784–790, 806–807, 835, 858, 868, 877–878, 890–891, 894–896, 899–902, 905–908, 910–912, 914, 918–919, 921, 924, 926, 939–940, 944
TOTAL533172613850% 

Pytest Report

Tests Skipped Failures Errors Time
1088 107 💤 0 ❌ 0 🔥 5m 0s ⏱️

@amitsrivastava amitsrivastava force-pushed the dev/amit/django-upgrade branch from a77200e to 6ab0d26 Compare March 10, 2025 21:43
Copy link

⚠️ No unit test files modified. Please ensure that changes are properly tested. ⚠️

Several other libraries have also been upgraded along with it.
Four code changes had to be made.

1. Django 4 wants the middlewares to be explicitly sync and async.
Rather than rewriting all of the middleware classes, I took the
shortcut of creating a new mixin class that supports only sync calls.

2. CSRF_TRUSTED_ORIGINS in django 4+ need the scheme part as well. We
now check and add `http` and `https` to the origins.

3. django-babel also needs a change every time we do a django upgrade.
This is mostly just changes around django version support.
@amitsrivastava amitsrivastava force-pushed the dev/amit/django-upgrade branch from 6ab0d26 to fdb4095 Compare March 11, 2025 03:57
@amitsrivastava amitsrivastava enabled auto-merge (rebase) March 11, 2025 03:57
Copy link

⚠️ No unit test files modified. Please ensure that changes are properly tested. ⚠️

Copy link
Collaborator

@Harshg999 Harshg999 left a comment

Choose a reason for hiding this comment

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

LGTM!

@amitsrivastava amitsrivastava merged commit 9ea4732 into master Mar 11, 2025
8 checks passed
@amitsrivastava amitsrivastava deleted the dev/amit/django-upgrade branch March 11, 2025 12:22
@Kimahriman
Copy link

I think this broke downloads: #4086

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.

4 participants