Merge lp:~fo0bar/turku/turku-api-focal into lp:turku/turku-api

Proposed by Ryan Finnie
Status: Merged
Approved by: Joel Sing
Approved revision: 63
Merged at revision: 63
Proposed branch: lp:~fo0bar/turku/turku-api-focal
Merge into: lp:turku/turku-api
Diff against target: 115 lines (+17/-10)
4 files modified
turku_api/admin.py (+4/-1)
turku_api/models.py (+6/-6)
turku_api/settings.py (+2/-1)
turku_api/urls.py (+5/-2)
To merge this branch: bzr merge lp:~fo0bar/turku/turku-api-focal
Reviewer Review Type Date Requested Status
Joel Sing +1 Approve
Review via email: mp+382102@code.launchpad.net

Commit message

Add compatibility for Django 2.2 (Ubuntu focal)

Description of the change

- reverse/reverse_lazy changed from django.core.urlresolvers to
  django.urls
- MIDDLEWARE_CLASSES changed to MIDDLEWARE
- Model ForeignKey on_delete=models.CASCADE changed from implicit to
  explicit

To post a comment you must log in.
Revision history for this message
Canonical IS Mergebot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Joel Sing (jsing) wrote :

LGTM, thanks.

review: Approve (+1)
Revision history for this message
Canonical IS Mergebot (canonical-is-mergebot) wrote :

Change successfully merged at revision 63

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'turku_api/admin.py'
2--- turku_api/admin.py 2020-03-24 23:07:22 +0000
3+++ turku_api/admin.py 2020-04-11 21:24:06 +0000
4@@ -20,7 +20,10 @@
5 from django.utils.html import format_html
6 from django.utils import timezone
7 from django.contrib.humanize.templatetags.humanize import naturaltime
8-from django.core.urlresolvers import reverse
9+try:
10+ from django.urls import reverse # 1.10+
11+except ModuleNotFoundError:
12+ from django.core.urlresolvers import reverse # pre-1.10
13 import datetime
14
15
16
17=== modified file 'turku_api/models.py'
18--- turku_api/models.py 2020-03-24 23:07:22 +0000
19+++ turku_api/models.py 2020-04-11 21:24:06 +0000
20@@ -172,7 +172,7 @@
21 help_text='Available disk space of this storage unit\'s storage directories, in MiB.',
22 )
23 auth = models.ForeignKey(
24- Auth, validators=[validate_storage_auth],
25+ Auth, validators=[validate_storage_auth], on_delete=models.CASCADE,
26 help_text='Storage auth used to register this storage unit.',
27 )
28 active = models.BooleanField(
29@@ -248,11 +248,11 @@
30 help_text='SSH public key of this machine\'s agent.',
31 )
32 auth = models.ForeignKey(
33- Auth, validators=[validate_machine_auth],
34+ Auth, validators=[validate_machine_auth], on_delete=models.CASCADE,
35 help_text='Machine auth used to register this machine.',
36 )
37 storage = models.ForeignKey(
38- Storage,
39+ Storage, on_delete=models.CASCADE,
40 help_text='Storage unit this machine is assigned to.',
41 )
42 active = models.BooleanField(
43@@ -303,7 +303,7 @@
44 help_text='Computer-readable source name identifier.',
45 )
46 machine = models.ForeignKey(
47- Machine,
48+ Machine, on_delete=models.CASCADE,
49 help_text='Machine this source belongs to.',
50 )
51 comment = models.CharField(
52@@ -400,7 +400,7 @@
53 class BackupLog(models.Model):
54 id = UuidPrimaryKeyField()
55 source = models.ForeignKey(
56- Source,
57+ Source, on_delete=models.CASCADE,
58 help_text='Source this log entry belongs to.',
59 )
60 date = models.DateTimeField(
61@@ -408,7 +408,7 @@
62 help_text='Date/time this log entry was received/processed.',
63 )
64 storage = models.ForeignKey(
65- Storage, blank=True, null=True,
66+ Storage, blank=True, null=True, on_delete=models.CASCADE,
67 help_text='Storage unit this backup occurred on.',
68 )
69 success = models.BooleanField(
70
71=== modified file 'turku_api/settings.py'
72--- turku_api/settings.py 2020-03-24 23:07:22 +0000
73+++ turku_api/settings.py 2020-04-11 21:24:06 +0000
74@@ -31,7 +31,7 @@
75 'django.contrib.staticfiles',
76 'turku_api',
77 )
78-MIDDLEWARE_CLASSES = (
79+MIDDLEWARE = (
80 'django.contrib.sessions.middleware.SessionMiddleware',
81 'django.middleware.common.CommonMiddleware',
82 'django.middleware.csrf.CsrfViewMiddleware',
83@@ -39,6 +39,7 @@
84 'django.contrib.messages.middleware.MessageMiddleware',
85 'django.middleware.clickjacking.XFrameOptionsMiddleware',
86 )
87+MIDDLEWARE_CLASSES = MIDDLEWARE # pre-1.10
88 ROOT_URLCONF = 'turku_api.urls'
89 WSGI_APPLICATION = 'turku_api.wsgi.application'
90 LANGUAGE_CODE = 'en-us'
91
92=== modified file 'turku_api/urls.py'
93--- turku_api/urls.py 2020-03-24 21:50:17 +0000
94+++ turku_api/urls.py 2020-04-11 21:24:06 +0000
95@@ -15,7 +15,10 @@
96 # <http://www.gnu.org/licenses/>.
97
98 from django.conf.urls import include, url
99-from django.core.urlresolvers import reverse_lazy
100+try:
101+ from django.urls import reverse_lazy # 1.10+
102+except ModuleNotFoundError:
103+ from django.core.urlresolvers import reverse_lazy # pre-1.10
104 from django.views.generic.base import RedirectView
105 from turku_api import views
106 from django.contrib import admin
107@@ -32,7 +35,7 @@
108 url(r'^v1/storage_ping_checkin$', views.storage_ping_checkin, name='storage_ping_checkin'),
109 url(r'^v1/storage_ping_source_update$', views.storage_ping_source_update, name='storage_ping_source_update'),
110 url(r'^v1/storage_update_config$', views.storage_update_config, name='storage_update_config'),
111- url(r'^admin/', include(admin.site.urls)),
112+ url(r'^admin/', admin.site.urls),
113 ]
114
115 try:

Subscribers

People subscribed via source and target branches

to all changes: