[PR #4861] [MERGED] Upgrade to Django 3.1 (v2.9) #12933

Closed
opened 2025-12-29 22:24:26 +01:00 by adam · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbox-community/netbox/pull/4861
Author: @jeremystretch
Created: 7/16/2020
Status: Merged
Merged: 7/20/2020
Merged by: @jeremystretch

Base: develop-2.9Head: django-31


📝 Commits (9)

  • 8dd41b7 Update import locations for Django 3.1
  • 68ecddc Convert NullBooleanField to BooleanField(null=True)
  • 21a750e Change Postgres-specific JSONField to stock Django field
  • 82cd24a Remove deprecated ifequal template tags
  • bdf4145 Pin Django version to 3.1-beta1 for v2.9 beta
  • 1dbf776 Fix handling of ProtectedError exceptions
  • 5b43fa0 Upgrade Django to 3.1RC1
  • 39dc1f8 Merge branch 'develop-2.9' into django-31
  • 0f679e1 Closes #4871: Specify ordering for querysets using annotate() to count related objects

📊 Changes

32 files changed (+314 additions, -119 deletions)

View changed files

📝 netbox/circuits/api/views.py (+2 -2)
netbox/circuits/migrations/0019_nullbooleanfield_to_booleanfield.py (+18 -0)
📝 netbox/circuits/models.py (+3 -2)
📝 netbox/circuits/views.py (+5 -5)
📝 netbox/dcim/api/views.py (+22 -14)
netbox/dcim/migrations/0113_nullbooleanfield_to_booleanfield.py (+43 -0)
netbox/dcim/migrations/0114_update_jsonfield.py (+23 -0)
📝 netbox/dcim/models/__init__.py (+5 -4)
📝 netbox/dcim/models/device_components.py (+15 -10)
📝 netbox/dcim/views.py (+35 -13)
netbox/extras/migrations/0046_update_jsonfield.py (+28 -0)
📝 netbox/extras/models/change_logging.py (+1 -2)
📝 netbox/extras/models/models.py (+3 -4)
📝 netbox/extras/scripts.py (+1 -1)
📝 netbox/ipam/api/views.py (+5 -5)
📝 netbox/ipam/views.py (+9 -5)
📝 netbox/netbox/views.py (+12 -4)
📝 netbox/secrets/api/views.py (+1 -1)
📝 netbox/secrets/views.py (+2 -2)
📝 netbox/templates/inc/paginator.html (+1 -1)

...and 12 more files

📄 Description

This is a draft PR to track the work necessary for upgrading to Django 3.1. Most issues have been addressed, however there remains a bug regarding queryset ordering when annotations are used. This was called out as an intentional change in Django 2.2, however I'm not sure we have a reasonable workaround (further comments below).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbox-community/netbox/pull/4861 **Author:** [@jeremystretch](https://github.com/jeremystretch) **Created:** 7/16/2020 **Status:** ✅ Merged **Merged:** 7/20/2020 **Merged by:** [@jeremystretch](https://github.com/jeremystretch) **Base:** `develop-2.9` ← **Head:** `django-31` --- ### 📝 Commits (9) - [`8dd41b7`](https://github.com/netbox-community/netbox/commit/8dd41b771ee89f17c0be40eeb05451079657c07f) Update import locations for Django 3.1 - [`68ecddc`](https://github.com/netbox-community/netbox/commit/68ecddccdb148176fb25347a1af6abd78fe0513b) Convert NullBooleanField to BooleanField(null=True) - [`21a750e`](https://github.com/netbox-community/netbox/commit/21a750e8ec7bb02e7ab471e685ab931f8f8ec82e) Change Postgres-specific JSONField to stock Django field - [`82cd24a`](https://github.com/netbox-community/netbox/commit/82cd24a7dec61a40057ffd8ba474bb60b2117031) Remove deprecated ifequal template tags - [`bdf4145`](https://github.com/netbox-community/netbox/commit/bdf41451eb42aa2b31a35305e99e8f584a39a249) Pin Django version to 3.1-beta1 for v2.9 beta - [`1dbf776`](https://github.com/netbox-community/netbox/commit/1dbf776279abfc645e31bb8dea4a76dfab699ea3) Fix handling of ProtectedError exceptions - [`5b43fa0`](https://github.com/netbox-community/netbox/commit/5b43fa0e12e98cc9a401c21ef9c75c2c80a35697) Upgrade Django to 3.1RC1 - [`39dc1f8`](https://github.com/netbox-community/netbox/commit/39dc1f882a213f0bc63d1c71d8ee59546b9f0fad) Merge branch 'develop-2.9' into django-31 - [`0f679e1`](https://github.com/netbox-community/netbox/commit/0f679e1f0374ddc14e2aa3ce4c4689233472be37) Closes #4871: Specify ordering for querysets using annotate() to count related objects ### 📊 Changes **32 files changed** (+314 additions, -119 deletions) <details> <summary>View changed files</summary> 📝 `netbox/circuits/api/views.py` (+2 -2) ➕ `netbox/circuits/migrations/0019_nullbooleanfield_to_booleanfield.py` (+18 -0) 📝 `netbox/circuits/models.py` (+3 -2) 📝 `netbox/circuits/views.py` (+5 -5) 📝 `netbox/dcim/api/views.py` (+22 -14) ➕ `netbox/dcim/migrations/0113_nullbooleanfield_to_booleanfield.py` (+43 -0) ➕ `netbox/dcim/migrations/0114_update_jsonfield.py` (+23 -0) 📝 `netbox/dcim/models/__init__.py` (+5 -4) 📝 `netbox/dcim/models/device_components.py` (+15 -10) 📝 `netbox/dcim/views.py` (+35 -13) ➕ `netbox/extras/migrations/0046_update_jsonfield.py` (+28 -0) 📝 `netbox/extras/models/change_logging.py` (+1 -2) 📝 `netbox/extras/models/models.py` (+3 -4) 📝 `netbox/extras/scripts.py` (+1 -1) 📝 `netbox/ipam/api/views.py` (+5 -5) 📝 `netbox/ipam/views.py` (+9 -5) 📝 `netbox/netbox/views.py` (+12 -4) 📝 `netbox/secrets/api/views.py` (+1 -1) 📝 `netbox/secrets/views.py` (+2 -2) 📝 `netbox/templates/inc/paginator.html` (+1 -1) _...and 12 more files_ </details> ### 📄 Description This is a draft PR to track the work necessary for upgrading to Django 3.1. Most issues have been addressed, however there remains a bug regarding queryset ordering when annotations are used. This was called out as [an intentional change in Django 2.2](https://docs.djangoproject.com/en/3.1/releases/2.2/#model-meta-ordering-will-no-longer-affect-group-by-queries), however I'm not sure we have a reasonable workaround (further comments below). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
adam added the pull-request label 2025-12-29 22:24:26 +01:00
adam closed this issue 2025-12-29 22:24:26 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#12933