misc: change django-upgrade target version to 3.2 (#75442)
This commit is contained in:
parent
3772e5546b
commit
f4bca2d2fe
|
@ -17,10 +17,10 @@ repos:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args: ['--keep-percent-format', '--py37-plus']
|
args: ['--keep-percent-format', '--py37-plus']
|
||||||
- repo: https://github.com/adamchainz/django-upgrade
|
- repo: https://github.com/adamchainz/django-upgrade
|
||||||
rev: 1.10.0
|
rev: 1.13.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: django-upgrade
|
- id: django-upgrade
|
||||||
args: ['--target-version', '2.2']
|
args: ['--target-version', '3.2']
|
||||||
- repo: https://github.com/rtts/djhtml
|
- repo: https://github.com/rtts/djhtml
|
||||||
rev: 'v1.5.2'
|
rev: 'v1.5.2'
|
||||||
hooks:
|
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 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:
|
djhtml is used to automatically indent html files, using those parameters:
|
||||||
|
|
||||||
|
|
|
@ -15,9 +15,9 @@
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from django.apps import apps
|
from django.apps import apps
|
||||||
from django.contrib.postgres.fields import JSONField
|
|
||||||
from django.core.management.base import BaseCommand, CommandError
|
from django.core.management.base import BaseCommand, CommandError
|
||||||
from django.db import connection
|
from django.db import connection
|
||||||
|
from django.db.models import JSONField
|
||||||
|
|
||||||
|
|
||||||
class Command(BaseCommand):
|
class Command(BaseCommand):
|
||||||
|
|
|
@ -33,7 +33,7 @@ from dateutil.rrule import DAILY, WEEKLY, rrule, rruleset
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.contrib.auth.models import Group
|
from django.contrib.auth.models import Group
|
||||||
from django.contrib.humanize.templatetags.humanize import ordinal
|
from django.contrib.humanize.templatetags.humanize import ordinal
|
||||||
from django.contrib.postgres.fields import ArrayField, JSONField
|
from django.contrib.postgres.fields import ArrayField
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
from django.core.validators import MaxValueValidator, MinValueValidator
|
from django.core.validators import MaxValueValidator, MinValueValidator
|
||||||
from django.db import connection, models, transaction
|
from django.db import connection, models, transaction
|
||||||
|
@ -44,6 +44,7 @@ from django.db.models import (
|
||||||
F,
|
F,
|
||||||
Func,
|
Func,
|
||||||
IntegerField,
|
IntegerField,
|
||||||
|
JSONField,
|
||||||
Max,
|
Max,
|
||||||
OuterRef,
|
OuterRef,
|
||||||
Prefetch,
|
Prefetch,
|
||||||
|
@ -1689,22 +1690,12 @@ class Event(models.Model):
|
||||||
if agendas:
|
if agendas:
|
||||||
overlapping_events = overlapping_events.filter(agenda__in=agendas)
|
overlapping_events = overlapping_events.filter(agenda__in=agendas)
|
||||||
|
|
||||||
if django.VERSION >= (3, 2):
|
from django.db.models.functions import JSONObject
|
||||||
from django.db.models.functions import JSONObject
|
|
||||||
|
|
||||||
json_object = JSONObject(
|
json_object = JSONObject(
|
||||||
slug=F('computed_slug'),
|
slug=F('computed_slug'),
|
||||||
days=F('recurrence_days'),
|
days=F('recurrence_days'),
|
||||||
)
|
)
|
||||||
else:
|
|
||||||
json_object = Func(
|
|
||||||
Value('slug'),
|
|
||||||
'computed_slug',
|
|
||||||
Value('days'),
|
|
||||||
'recurrence_days',
|
|
||||||
function='jsonb_build_object',
|
|
||||||
output_field=JSONField(),
|
|
||||||
)
|
|
||||||
|
|
||||||
return qs.annotate(
|
return qs.annotate(
|
||||||
overlaps=ArraySubquery(
|
overlaps=ArraySubquery(
|
||||||
|
@ -2142,7 +2133,7 @@ class Booking(models.Model):
|
||||||
user_first_name = models.CharField(max_length=250, blank=True)
|
user_first_name = models.CharField(max_length=250, blank=True)
|
||||||
user_email = models.EmailField(blank=True)
|
user_email = models.EmailField(blank=True)
|
||||||
user_phone_number = models.CharField(max_length=30, blank=True)
|
user_phone_number = models.CharField(max_length=30, blank=True)
|
||||||
user_was_present = models.NullBooleanField()
|
user_was_present = models.BooleanField(null=True)
|
||||||
user_check_type_slug = models.CharField(max_length=160, blank=True, null=True)
|
user_check_type_slug = models.CharField(max_length=160, blank=True, null=True)
|
||||||
user_check_type_label = models.CharField(max_length=150, blank=True, null=True)
|
user_check_type_label = models.CharField(max_length=150, blank=True, null=True)
|
||||||
out_of_min_delay = models.BooleanField(default=False)
|
out_of_min_delay = models.BooleanField(default=False)
|
||||||
|
|
|
@ -83,7 +83,7 @@ WSGI_APPLICATION = 'chrono.wsgi.application'
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,15 +28,15 @@ from .views import LoginView, LogoutView, homepage
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', homepage, name='home'),
|
path('', homepage, name='home'),
|
||||||
re_path(r'^manage/', decorated_includes(login_required, include(chrono_manager_urls))),
|
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('logout/', LogoutView.as_view(), name='auth_logout'),
|
||||||
path('login/', LoginView.as_view(), name='auth_login'),
|
path('login/', LoginView.as_view(), name='auth_login'),
|
||||||
]
|
]
|
||||||
|
|
||||||
if 'mellon' in settings.INSTALLED_APPS:
|
if 'mellon' in settings.INSTALLED_APPS:
|
||||||
urlpatterns.append(
|
urlpatterns.append(
|
||||||
re_path(
|
path(
|
||||||
r'^accounts/mellon/',
|
'accounts/mellon/',
|
||||||
include('mellon.urls'),
|
include('mellon.urls'),
|
||||||
kwargs={
|
kwargs={
|
||||||
'template_base': 'chrono/manager_base.html',
|
'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
|
import debug_toolbar # pylint: disable=import-error
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
re_path(r'^__debug__/', include(debug_toolbar.urls)),
|
path('__debug__/', include(debug_toolbar.urls)),
|
||||||
] + urlpatterns
|
] + urlpatterns
|
||||||
|
|
||||||
# static and media files
|
# static and media files
|
||||||
|
|
|
@ -10,7 +10,7 @@ REST_FRAMEWORK = {
|
||||||
|
|
||||||
DATABASES = {
|
DATABASES = {
|
||||||
'default': {
|
'default': {
|
||||||
'ENGINE': 'django.db.backends.postgresql_psycopg2',
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
'TEST': {
|
'TEST': {
|
||||||
'NAME': 'chrono-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-')[:45],
|
'NAME': 'chrono-test-%s' % os.environ.get("BRANCH_NAME", "").replace('/', '-')[:45],
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue