mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-14 01:41:22 -06:00
Upgrade Django to 3.2b1
This commit is contained in:
parent
b1cd634ab4
commit
0a6ebdee48
@ -1,7 +1,8 @@
|
|||||||
|
from django.contrib.postgres.aggregates import JSONBAgg
|
||||||
from django.db.models import OuterRef, Subquery, Q
|
from django.db.models import OuterRef, Subquery, Q
|
||||||
|
|
||||||
from extras.models.tags import TaggedItem
|
from extras.models.tags import TaggedItem
|
||||||
from utilities.query_functions import EmptyGroupByJSONBAgg, OrderableJSONBAgg
|
from utilities.query_functions import EmptyGroupByJSONBAgg
|
||||||
from utilities.querysets import RestrictedQuerySet
|
from utilities.querysets import RestrictedQuerySet
|
||||||
|
|
||||||
|
|
||||||
@ -47,7 +48,7 @@ class ConfigContextQuerySet(RestrictedQuerySet):
|
|||||||
|
|
||||||
if aggregate_data:
|
if aggregate_data:
|
||||||
return queryset.aggregate(
|
return queryset.aggregate(
|
||||||
config_context_data=OrderableJSONBAgg('data', ordering=['weight', 'name'])
|
config_context_data=JSONBAgg('data', ordering=['weight', 'name'])
|
||||||
)['config_context_data']
|
)['config_context_data']
|
||||||
|
|
||||||
return queryset
|
return queryset
|
||||||
|
@ -210,6 +210,7 @@ class PrefixTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
|||||||
Role(name='Role 1', slug='role-1'),
|
Role(name='Role 1', slug='role-1'),
|
||||||
Role(name='Role 2', slug='role-2'),
|
Role(name='Role 2', slug='role-2'),
|
||||||
)
|
)
|
||||||
|
Role.objects.bulk_create(roles)
|
||||||
|
|
||||||
Prefix.objects.bulk_create([
|
Prefix.objects.bulk_create([
|
||||||
Prefix(prefix=IPNetwork('10.1.0.0/16'), vrf=vrfs[0], site=sites[0], role=roles[0]),
|
Prefix(prefix=IPNetwork('10.1.0.0/16'), vrf=vrfs[0], site=sites[0], role=roles[0]),
|
||||||
|
@ -375,6 +375,8 @@ LOGIN_URL = '/{}login/'.format(BASE_PATH)
|
|||||||
|
|
||||||
CSRF_TRUSTED_ORIGINS = ALLOWED_HOSTS
|
CSRF_TRUSTED_ORIGINS = ALLOWED_HOSTS
|
||||||
|
|
||||||
|
DEFAULT_AUTO_FIELD = 'django.db.models.AutoField'
|
||||||
|
|
||||||
# Exclude potentially sensitive models from wildcard view exemption. These may still be exempted
|
# Exclude potentially sensitive models from wildcard view exemption. These may still be exempted
|
||||||
# by specifying the model individually in the EXEMPT_VIEW_PERMISSIONS configuration parameter.
|
# by specifying the model individually in the EXEMPT_VIEW_PERMISSIONS configuration parameter.
|
||||||
EXEMPT_EXCLUDE_MODELS = (
|
EXEMPT_EXCLUDE_MODELS = (
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
from django.contrib.postgres.aggregates import JSONBAgg
|
from django.contrib.postgres.aggregates import JSONBAgg
|
||||||
from django.contrib.postgres.aggregates.mixins import OrderableAggMixin
|
|
||||||
from django.db.models import F, Func
|
from django.db.models import F, Func
|
||||||
|
|
||||||
|
|
||||||
@ -11,19 +10,10 @@ class CollateAsChar(Func):
|
|||||||
template = '(%(expressions)s) COLLATE "%(function)s"'
|
template = '(%(expressions)s) COLLATE "%(function)s"'
|
||||||
|
|
||||||
|
|
||||||
class OrderableJSONBAgg(OrderableAggMixin, JSONBAgg):
|
class EmptyGroupByJSONBAgg(JSONBAgg):
|
||||||
"""
|
|
||||||
TODO in Django 3.2 ordering is supported natively on JSONBAgg so this is no longer needed.
|
|
||||||
"""
|
|
||||||
template = '%(function)s(%(distinct)s%(expressions)s %(ordering)s)'
|
|
||||||
|
|
||||||
|
|
||||||
class EmptyGroupByJSONBAgg(OrderableJSONBAgg):
|
|
||||||
"""
|
"""
|
||||||
JSONBAgg is a builtin aggregation function which means it includes the use of a GROUP BY clause.
|
JSONBAgg is a builtin aggregation function which means it includes the use of a GROUP BY clause.
|
||||||
When used as an annotation for collecting config context data objects, the GROUP BY is
|
When used as an annotation for collecting config context data objects, the GROUP BY is
|
||||||
incorrect. This subclass overrides the Django ORM aggregation control to remove the GROUP BY.
|
incorrect. This subclass overrides the Django ORM aggregation control to remove the GROUP BY.
|
||||||
|
|
||||||
TODO in Django 3.2 ordering is supported natively on JSONBAgg so we only need to inherit from JSONBAgg.
|
|
||||||
"""
|
"""
|
||||||
contains_aggregate = False
|
contains_aggregate = False
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
Django==3.1.3
|
Django==3.2b1
|
||||||
django-cacheops==5.1
|
django-cacheops==5.1
|
||||||
django-cors-headers==3.5.0
|
django-cors-headers==3.5.0
|
||||||
django-debug-toolbar==3.1.1
|
django-debug-toolbar==3.1.1
|
||||||
|
Loading…
Reference in New Issue
Block a user