misc: change django-upgrade target version to 3.2 (#75442)
This commit is contained in:
parent
db6f11c7c0
commit
de227cfe26
|
@ -17,10 +17,10 @@ repos:
|
|||
- id: pyupgrade
|
||||
args: ['--keep-percent-format', '--py37-plus']
|
||||
- repo: https://github.com/adamchainz/django-upgrade
|
||||
rev: 1.10.0
|
||||
rev: 1.13.0
|
||||
hooks:
|
||||
- id: django-upgrade
|
||||
args: ['--target-version', '2.2']
|
||||
args: ['--target-version', '3.2']
|
||||
- repo: https://github.com/rtts/djhtml
|
||||
rev: 'v1.5.2'
|
||||
hooks:
|
||||
|
|
2
README
2
README
|
@ -46,7 +46,7 @@ pyupgrade is used to automatically upgrade syntax, using those parameters:
|
|||
|
||||
django-upgrade is used to automatically upgrade Django syntax, using those parameters:
|
||||
|
||||
django-upgrade --target-version 2.2
|
||||
django-upgrade --target-version 3.2
|
||||
|
||||
djhtml is used to automatically indent html files, using those parameters:
|
||||
|
||||
|
|
|
@ -25,7 +25,6 @@ import sys
|
|||
import uuid
|
||||
from contextlib import contextmanager
|
||||
|
||||
import django
|
||||
import requests
|
||||
import vobject
|
||||
from dateutil.relativedelta import SU, relativedelta
|
||||
|
@ -51,7 +50,7 @@ from django.db.models import (
|
|||
Subquery,
|
||||
Value,
|
||||
)
|
||||
from django.db.models.functions import Cast, Coalesce, Concat, ExtractWeek, ExtractWeekDay
|
||||
from django.db.models.functions import Cast, Coalesce, Concat, ExtractWeek, ExtractWeekDay, JSONObject
|
||||
from django.template import Context, Template, TemplateSyntaxError, VariableDoesNotExist, engines
|
||||
from django.urls import reverse
|
||||
from django.utils import functional
|
||||
|
@ -1697,22 +1696,10 @@ class Event(models.Model):
|
|||
if agendas:
|
||||
overlapping_events = overlapping_events.filter(agenda__in=agendas)
|
||||
|
||||
if django.VERSION >= (3, 2):
|
||||
from django.db.models.functions import JSONObject
|
||||
|
||||
json_object = JSONObject(
|
||||
slug=F('computed_slug'),
|
||||
days=F('recurrence_days'),
|
||||
)
|
||||
else:
|
||||
json_object = Func(
|
||||
Value('slug'),
|
||||
'computed_slug',
|
||||
Value('days'),
|
||||
'recurrence_days',
|
||||
function='jsonb_build_object',
|
||||
output_field=models.JSONField(),
|
||||
)
|
||||
|
||||
return qs.annotate(
|
||||
overlaps=ArraySubquery(
|
||||
|
|
|
@ -83,7 +83,7 @@ WSGI_APPLICATION = 'chrono.wsgi.application'
|
|||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,15 +28,15 @@ from .views import LoginView, LogoutView, homepage
|
|||
urlpatterns = [
|
||||
path('', homepage, name='home'),
|
||||
re_path(r'^manage/', decorated_includes(login_required, include(chrono_manager_urls))),
|
||||
re_path(r'^api/', include(chrono_api_urls)),
|
||||
path('api/', include(chrono_api_urls)),
|
||||
path('logout/', LogoutView.as_view(), name='auth_logout'),
|
||||
path('login/', LoginView.as_view(), name='auth_login'),
|
||||
]
|
||||
|
||||
if 'mellon' in settings.INSTALLED_APPS:
|
||||
urlpatterns.append(
|
||||
re_path(
|
||||
r'^accounts/mellon/',
|
||||
path(
|
||||
'accounts/mellon/',
|
||||
include('mellon.urls'),
|
||||
kwargs={
|
||||
'template_base': 'chrono/manager_base.html',
|
||||
|
@ -48,7 +48,7 @@ if settings.DEBUG and 'debug_toolbar' in settings.INSTALLED_APPS:
|
|||
import debug_toolbar # pylint: disable=import-error
|
||||
|
||||
urlpatterns = [
|
||||
re_path(r'^__debug__/', include(debug_toolbar.urls)),
|
||||
path('__debug__/', include(debug_toolbar.urls)),
|
||||
] + urlpatterns
|
||||
|
||||
# static and media files
|
||||
|
|
|
@ -10,7 +10,7 @@ REST_FRAMEWORK = {
|
|||
|
||||
DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
||||
'ENGINE': 'django.db.backends.postgresql',
|
||||
'TEST': {
|
||||
'NAME': 'chrono-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-')[:45],
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue