mirror of
https://github.com/netbox-community/netbox.git
synced 2026-03-05 05:50:10 +01:00
Compare commits
8 Commits
17654-asn
...
django-6.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3998bece4b | ||
|
|
6a06bf1d9e | ||
|
|
369c03f305 | ||
|
|
7a0cf65252 | ||
|
|
6eafffb497 | ||
|
|
53ea48efa9 | ||
|
|
1a404f5c0f | ||
|
|
3320e07b70 |
@@ -4,7 +4,7 @@ colorama
|
||||
|
||||
# The Python web framework on which NetBox is built
|
||||
# https://docs.djangoproject.com/en/stable/releases/
|
||||
Django==5.2.*
|
||||
Django==6.0.*
|
||||
|
||||
# Django middleware which permits cross-domain API requests
|
||||
# https://github.com/adamchainz/django-cors-headers/blob/main/CHANGELOG.rst
|
||||
@@ -35,7 +35,9 @@ django-pglocks
|
||||
|
||||
# Prometheus metrics library for Django
|
||||
# https://github.com/korfuri/django-prometheus/blob/master/CHANGELOG.md
|
||||
django-prometheus
|
||||
# TODO: 2.4.1 is incompatible with Django>=6.0, but a fixed release is expected
|
||||
# https://github.com/django-commons/django-prometheus/issues/494
|
||||
django-prometheus>=2.4.0,<2.5.0,!=2.4.1
|
||||
|
||||
# Django caching backend using Redis
|
||||
# https://github.com/jazzband/django-redis/blob/master/CHANGELOG.rst
|
||||
|
||||
@@ -31,6 +31,11 @@ The following data is available as context for Jinja2 templates:
|
||||
* `data` - A detailed representation of the object in its current state. This is typically equivalent to the model's representation in NetBox's REST API.
|
||||
* `snapshots` - Minimal "snapshots" of the object state both before and after the change was made; provided as a dictionary with keys named `prechange` and `postchange`. These are not as extensive as the fully serialized representation, but contain enough information to convey what has changed.
|
||||
|
||||
!!! warning "Deprecation of legacy fields"
|
||||
The "request_id" and "username" fields in the webhook payload above are deprecated and should no longer be used. Support for them will be removed in NetBox v4.7.0.
|
||||
|
||||
Use `request.user.username` and `request.request_id` from the `request` object included in the callback context instead.
|
||||
|
||||
### Default Request Body
|
||||
|
||||
If no body template is specified, the request body will be populated with a JSON object containing the context data. For example, a newly created site might appear as follows:
|
||||
|
||||
@@ -88,3 +88,8 @@ The following context variables are available in to the text and link templates.
|
||||
| `request_id` | The unique request ID |
|
||||
| `data` | A complete serialized representation of the object |
|
||||
| `snapshots` | Pre- and post-change snapshots of the object |
|
||||
|
||||
!!! warning "Deprecation of legacy fields"
|
||||
The "request_id" and "username" fields in the webhook payload above are deprecated and should no longer be used. Support for them will be removed in NetBox v4.7.0.
|
||||
|
||||
Use `request.user.username` and `request.request_id` from the `request` object included in the callback context instead.
|
||||
|
||||
@@ -43,6 +43,11 @@ The resulting webhook payload will look like the following:
|
||||
}
|
||||
```
|
||||
|
||||
!!! warning "Deprecation of legacy fields"
|
||||
The "request_id" and "username" fields in the webhook payload above are deprecated and should no longer be used. Support for them will be removed in NetBox v4.7.0.
|
||||
|
||||
Use `request.user.username` and `request.request_id` from the `request` object included in the callback context instead.
|
||||
|
||||
!!! note "Consider namespacing webhook data"
|
||||
The data returned from all webhook callbacks will be compiled into a single `context` dictionary. Any existing keys within this dictionary will be overwritten by subsequent callbacks which include those keys. To avoid collisions with webhook data provided by other plugins, consider namespacing your plugin's data within a nested dictionary as such:
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import warnings
|
||||
from datetime import timedelta
|
||||
from importlib import import_module
|
||||
|
||||
@@ -17,11 +18,12 @@ class Command(BaseCommand):
|
||||
help = "Perform nightly housekeeping tasks [DEPRECATED]"
|
||||
|
||||
def handle(self, *args, **options):
|
||||
self.stdout.write(
|
||||
warnings.warn(
|
||||
"\n\nDEPRECATION WARNING\n"
|
||||
"Running this command is no longer necessary: All housekeeping tasks\n"
|
||||
"are addressed automatically via NetBox's built-in job scheduler. It\n"
|
||||
"will be removed in a future release.",
|
||||
self.style.WARNING
|
||||
"will be removed in a future release.\n",
|
||||
category=FutureWarning,
|
||||
)
|
||||
|
||||
config = Config()
|
||||
|
||||
@@ -677,15 +677,19 @@ class ConfigContextTest(TestCase):
|
||||
if hasattr(node, 'children'):
|
||||
for child in node.children:
|
||||
try:
|
||||
if child.rhs.query.model is TaggedItem:
|
||||
subqueries.append(child.rhs.query)
|
||||
# In Django 6.0+, rhs is a Query directly; older Django wraps it in Subquery
|
||||
rhs_query = getattr(child.rhs, 'query', child.rhs)
|
||||
if rhs_query.model is TaggedItem:
|
||||
subqueries.append(rhs_query)
|
||||
except AttributeError:
|
||||
traverse(child)
|
||||
traverse(where_node)
|
||||
return subqueries
|
||||
|
||||
# In Django 6.0+, the annotation is a Query directly; older Django wraps it in Subquery
|
||||
annotation_query = getattr(config_annotation, 'query', config_annotation)
|
||||
# Find subqueries in the WHERE clause that should have DISTINCT
|
||||
tag_subqueries = find_tag_subqueries(config_annotation.query.where)
|
||||
tag_subqueries = find_tag_subqueries(annotation_query.where)
|
||||
distinct_subqueries = [sq for sq in tag_subqueries if sq.distinct]
|
||||
|
||||
# Verify we found at least one DISTINCT subquery for tags
|
||||
|
||||
@@ -94,9 +94,11 @@ class NetHost(Lookup):
|
||||
rhs, rhs_params = self.process_rhs(qn, connection)
|
||||
# Query parameters are automatically converted to IPNetwork objects, which are then turned to strings. We need
|
||||
# to omit the mask portion of the object's string representation to match PostgreSQL's HOST() function.
|
||||
# Note: params may be tuples (Django 6.0+) or lists (older Django), so convert before mutating.
|
||||
rhs_params = list(rhs_params)
|
||||
if rhs_params:
|
||||
rhs_params[0] = rhs_params[0].split('/')[0]
|
||||
params = lhs_params + rhs_params
|
||||
params = list(lhs_params) + rhs_params
|
||||
return f'HOST({lhs}) = {rhs}', params
|
||||
|
||||
|
||||
|
||||
@@ -435,6 +435,7 @@ INSTALLED_APPS = [
|
||||
'django.contrib.messages',
|
||||
'django.contrib.staticfiles',
|
||||
'django.contrib.humanize',
|
||||
'django.contrib.postgres',
|
||||
'django.forms',
|
||||
'corsheaders',
|
||||
'debug_toolbar',
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
colorama==0.4.6
|
||||
Django==5.2.11
|
||||
Django==6.0.3
|
||||
django-cors-headers==4.9.0
|
||||
django-debug-toolbar==6.2.0
|
||||
django-filter==25.2
|
||||
@@ -7,7 +7,7 @@ django-graphiql-debug-toolbar==0.2.0
|
||||
django-htmx==1.27.0
|
||||
django-mptt==0.18.0
|
||||
django-pglocks==1.0.4
|
||||
django-prometheus==2.4.1
|
||||
django-prometheus==2.4.0
|
||||
django-redis==6.0.0
|
||||
django-rich==2.2.0
|
||||
django-rq==3.2.2
|
||||
|
||||
Reference in New Issue
Block a user