Merge lp:~roadmr/canonical-identity-provider/fix-deprecation-warnings-1 into lp:canonical-identity-provider/release
- fix-deprecation-warnings-1
- Merge into trunk
Proposed by
Daniel Manrique
Status: | Merged |
---|---|
Approved by: | Daniel Manrique |
Approved revision: | no longer in the source branch. |
Merge reported by: | Otto Co-Pilot |
Merged at revision: | not available |
Proposed branch: | lp:~roadmr/canonical-identity-provider/fix-deprecation-warnings-1 |
Merge into: | lp:canonical-identity-provider/release |
Diff against target: |
325 lines (+43/-32) 12 files modified
Makefile (+1/-1) src/identityprovider/migrations/0001_initial.py (+11/-11) src/identityprovider/migrations/0005_authlog.py (+1/-1) src/identityprovider/models/account.py (+3/-2) src/identityprovider/models/authlog.py (+1/-1) src/identityprovider/models/authtoken.py (+2/-1) src/identityprovider/models/emailaddress.py (+4/-2) src/identityprovider/models/openidmodels.py (+4/-2) src/identityprovider/models/person.py (+7/-4) src/identityprovider/models/twofactor.py (+2/-1) src/oauth_backend/migrations/0001_initial.py (+4/-4) src/oauth_backend/models.py (+3/-2) |
To merge this branch: | bzr merge lp:~roadmr/canonical-identity-provider/fix-deprecation-warnings-1 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Maximiliano Bertacchini | Approve | ||
Review via email: mp+346897@code.launchpad.net |
Commit message
Fix deprecation warnings concerning on_delete on model field definitions and migrations.
This fixes only such warnings in this project's code; some remain on django-piston and django-openid-auth, which will be tackled separately.
Description of the change
Fix deprecation warnings concerning on_delete on model field definitions and migrations.
This fixes only such warnings in this project's code; some remain on django-piston and django-openid-auth, which will be tackled separately.
To post a comment you must log in.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Makefile' | |||
2 | --- Makefile 2018-04-16 21:22:24 +0000 | |||
3 | +++ Makefile 2018-05-25 18:10:37 +0000 | |||
4 | @@ -11,7 +11,7 @@ | |||
5 | 11 | LOCAL_SETTINGS_DIR ?= $(CURDIR)/../local_config | 11 | LOCAL_SETTINGS_DIR ?= $(CURDIR)/../local_config |
6 | 12 | LOCAL_SETTINGS_PATH = $(LOCAL_SETTINGS_DIR)/settings.py | 12 | LOCAL_SETTINGS_PATH = $(LOCAL_SETTINGS_DIR)/settings.py |
7 | 13 | FLAKE8 = $(ENV)/bin/flake8 | 13 | FLAKE8 = $(ENV)/bin/flake8 |
9 | 14 | PYTHON = $(ENV)/bin/python -Wd | 14 | PYTHON = $(ENV)/bin/python -Wd -Wignore:"Not importing":ImportWarning |
10 | 15 | PIP = $(PYTHON) $(ENV)/bin/pip | 15 | PIP = $(PYTHON) $(ENV)/bin/pip |
11 | 16 | SRC_DIR = $(CURDIR)/src | 16 | SRC_DIR = $(CURDIR)/src |
12 | 17 | LIB_DIR = $(CURDIR)/lib | 17 | LIB_DIR = $(CURDIR)/lib |
13 | 18 | 18 | ||
14 | === modified file 'src/identityprovider/migrations/0001_initial.py' | |||
15 | --- src/identityprovider/migrations/0001_initial.py 2015-06-26 16:21:26 +0000 | |||
16 | +++ src/identityprovider/migrations/0001_initial.py 2018-05-25 18:10:37 +0000 | |||
17 | @@ -69,7 +69,7 @@ | |||
18 | 69 | fields=[ | 69 | fields=[ |
19 | 70 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | 70 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
20 | 71 | ('password', identityprovider.models.account.PasswordField()), | 71 | ('password', identityprovider.models.account.PasswordField()), |
22 | 72 | ('account', models.OneToOneField(db_column=b'account', to='identityprovider.Account')), | 72 | ('account', models.OneToOneField(db_column=b'account', on_delete=models.CASCADE, to='identityprovider.Account')), |
23 | 73 | ], | 73 | ], |
24 | 74 | options={ | 74 | options={ |
25 | 75 | 'db_table': 'accountpassword', | 75 | 'db_table': 'accountpassword', |
26 | @@ -102,7 +102,7 @@ | |||
27 | 102 | ('name', models.TextField()), | 102 | ('name', models.TextField()), |
28 | 103 | ('counter', models.IntegerField(default=0)), | 103 | ('counter', models.IntegerField(default=0)), |
29 | 104 | ('device_type', models.TextField(null=True)), | 104 | ('device_type', models.TextField(null=True)), |
31 | 105 | ('account', models.ForeignKey(related_name='devices', to='identityprovider.Account')), | 105 | ('account', models.ForeignKey(related_name='devices', on_delete=models.CASCADE, to='identityprovider.Account')), |
32 | 106 | ], | 106 | ], |
33 | 107 | options={ | 107 | options={ |
34 | 108 | 'ordering': ('id',), | 108 | 'ordering': ('id',), |
35 | @@ -122,7 +122,7 @@ | |||
36 | 122 | ('redirection_url', models.TextField(null=True, blank=True)), | 122 | ('redirection_url', models.TextField(null=True, blank=True)), |
37 | 123 | ('displayname', identityprovider.models.account.DisplaynameField(null=True, blank=True)), | 123 | ('displayname', identityprovider.models.account.DisplaynameField(null=True, blank=True)), |
38 | 124 | ('password', identityprovider.models.account.PasswordField(null=True, blank=True)), | 124 | ('password', identityprovider.models.account.PasswordField(null=True, blank=True)), |
40 | 125 | ('requester', models.ForeignKey(db_column=b'requester', blank=True, to='identityprovider.Account', null=True)), | 125 | ('requester', models.ForeignKey(db_column=b'requester', blank=True, on_delete=models.CASCADE, to='identityprovider.Account', null=True)), |
41 | 126 | ], | 126 | ], |
42 | 127 | options={ | 127 | options={ |
43 | 128 | 'db_table': 'authtoken', | 128 | 'db_table': 'authtoken', |
44 | @@ -137,7 +137,7 @@ | |||
45 | 137 | ('lp_person', models.IntegerField(null=True, editable=False, db_column=b'person', blank=True)), | 137 | ('lp_person', models.IntegerField(null=True, editable=False, db_column=b'person', blank=True)), |
46 | 138 | ('status', models.IntegerField(choices=[(1, b'NEW'), (2, b'VALIDATED'), (4, b'PREFERRED')])), | 138 | ('status', models.IntegerField(choices=[(1, b'NEW'), (2, b'VALIDATED'), (4, b'PREFERRED')])), |
47 | 139 | ('date_created', models.DateTimeField(default=django.utils.timezone.now, editable=False, blank=True)), | 139 | ('date_created', models.DateTimeField(default=django.utils.timezone.now, editable=False, blank=True)), |
49 | 140 | ('account', models.ForeignKey(db_column=b'account', blank=True, to='identityprovider.Account', null=True)), | 140 | ('account', models.ForeignKey(db_column=b'account', blank=True, on_delete=models.CASCADE, to='identityprovider.Account', null=True)), |
50 | 141 | ], | 141 | ], |
51 | 142 | options={ | 142 | options={ |
52 | 143 | 'db_table': 'emailaddress', | 143 | 'db_table': 'emailaddress', |
53 | @@ -153,7 +153,7 @@ | |||
54 | 153 | ('date_created', models.DateTimeField(editable=False, blank=True)), | 153 | ('date_created', models.DateTimeField(editable=False, blank=True)), |
55 | 154 | ('date_invalidated', models.DateTimeField(default=django.utils.timezone.now, null=True, blank=True)), | 154 | ('date_invalidated', models.DateTimeField(default=django.utils.timezone.now, null=True, blank=True)), |
56 | 155 | ('account_notified', models.BooleanField(default=False)), | 155 | ('account_notified', models.BooleanField(default=False)), |
58 | 156 | ('account', models.ForeignKey(db_column=b'account', blank=True, to='identityprovider.Account', null=True)), | 156 | ('account', models.ForeignKey(db_column=b'account', blank=True, on_delete=models.CASCADE, to='identityprovider.Account', null=True)), |
59 | 157 | ], | 157 | ], |
60 | 158 | options={ | 158 | options={ |
61 | 159 | 'db_table': 'invalidated_emailaddress', | 159 | 'db_table': 'invalidated_emailaddress', |
62 | @@ -212,7 +212,7 @@ | |||
63 | 212 | ('date_created', models.DateTimeField(default=django.utils.timezone.now, editable=False, blank=True)), | 212 | ('date_created', models.DateTimeField(default=django.utils.timezone.now, editable=False, blank=True)), |
64 | 213 | ('date_expires', models.DateTimeField()), | 213 | ('date_expires', models.DateTimeField()), |
65 | 214 | ('trust_root', models.TextField()), | 214 | ('trust_root', models.TextField()), |
67 | 215 | ('account', models.ForeignKey(to='identityprovider.Account', db_column=b'account')), | 215 | ('account', models.ForeignKey(on_delete=models.CASCADE, to='identityprovider.Account', db_column=b'account')), |
68 | 216 | ], | 216 | ], |
69 | 217 | options={ | 217 | options={ |
70 | 218 | 'db_table': 'openidauthorization', | 218 | 'db_table': 'openidauthorization', |
71 | @@ -268,7 +268,7 @@ | |||
72 | 268 | ('date_last_used', models.DateTimeField(default=django.utils.timezone.now, editable=False, blank=True)), | 268 | ('date_last_used', models.DateTimeField(default=django.utils.timezone.now, editable=False, blank=True)), |
73 | 269 | ('total_logins', models.IntegerField(default=1)), | 269 | ('total_logins', models.IntegerField(default=1)), |
74 | 270 | ('approved_data', models.TextField(default='', null=True, blank=True)), | 270 | ('approved_data', models.TextField(default='', null=True, blank=True)), |
76 | 271 | ('account', models.ForeignKey(to='identityprovider.Account', db_column=b'account')), | 271 | ('account', models.ForeignKey(on_delete=models.CASCADE, to='identityprovider.Account', db_column=b'account')), |
77 | 272 | ], | 272 | ], |
78 | 273 | options={ | 273 | options={ |
79 | 274 | 'db_table': 'openidrpsummary', | 274 | 'db_table': 'openidrpsummary', |
80 | @@ -333,7 +333,7 @@ | |||
81 | 333 | ('date_last_modified', models.DateTimeField(null=True)), | 333 | ('date_last_modified', models.DateTimeField(null=True)), |
82 | 334 | ('visible', models.NullBooleanField(default=True)), | 334 | ('visible', models.NullBooleanField(default=True)), |
83 | 335 | ('locked', models.NullBooleanField(default=False)), | 335 | ('locked', models.NullBooleanField(default=False)), |
85 | 336 | ('person', models.OneToOneField(null=True, db_column=b'person', to='identityprovider.Person')), | 336 | ('person', models.OneToOneField(null=True, db_column=b'person', on_delete=models.CASCADE, to='identityprovider.Person')), |
86 | 337 | ], | 337 | ], |
87 | 338 | options={ | 338 | options={ |
88 | 339 | 'db_table': 'lp_personlocation', | 339 | 'db_table': 'lp_personlocation', |
89 | @@ -344,8 +344,8 @@ | |||
90 | 344 | name='TeamParticipation', | 344 | name='TeamParticipation', |
91 | 345 | fields=[ | 345 | fields=[ |
92 | 346 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | 346 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
95 | 347 | ('person', models.ForeignKey(db_column=b'person', to='identityprovider.Person', null=True)), | 347 | ('person', models.ForeignKey(db_column=b'person', on_delete=models.CASCADE, to='identityprovider.Person', null=True)), |
96 | 348 | ('team', models.ForeignKey(related_name='team_participations', db_column=b'team', to='identityprovider.Person', null=True)), | 348 | ('team', models.ForeignKey(related_name='team_participations', db_column=b'team', on_delete=models.CASCADE, to='identityprovider.Person', null=True)), |
97 | 349 | ], | 349 | ], |
98 | 350 | options={ | 350 | options={ |
99 | 351 | 'db_table': 'lp_teamparticipation', | 351 | 'db_table': 'lp_teamparticipation', |
100 | @@ -361,7 +361,7 @@ | |||
101 | 361 | ('secret', models.TextField(default=identityprovider.utils.generate_random_string_len_70)), | 361 | ('secret', models.TextField(default=identityprovider.utils.generate_random_string_len_70)), |
102 | 362 | ('date_created', models.DateTimeField(default=django.utils.timezone.now)), | 362 | ('date_created', models.DateTimeField(default=django.utils.timezone.now)), |
103 | 363 | ('date_updated', models.DateTimeField(default=django.utils.timezone.now)), | 363 | ('date_updated', models.DateTimeField(default=django.utils.timezone.now)), |
105 | 364 | ('consumer', models.ForeignKey(to='identityprovider.Account')), | 364 | ('consumer', models.ForeignKey(on_delete=models.CASCADE, to='identityprovider.Account')), |
106 | 365 | ], | 365 | ], |
107 | 366 | options={ | 366 | options={ |
108 | 367 | }, | 367 | }, |
109 | 368 | 368 | ||
110 | === modified file 'src/identityprovider/migrations/0005_authlog.py' | |||
111 | --- src/identityprovider/migrations/0005_authlog.py 2015-12-10 20:27:28 +0000 | |||
112 | +++ src/identityprovider/migrations/0005_authlog.py 2018-05-25 18:10:37 +0000 | |||
113 | @@ -38,7 +38,7 @@ | |||
114 | 38 | ('referer', models.TextField()), | 38 | ('referer', models.TextField()), |
115 | 39 | ('remote_ip', models.GenericIPAddressField()), | 39 | ('remote_ip', models.GenericIPAddressField()), |
116 | 40 | ('user_agent', models.TextField()), | 40 | ('user_agent', models.TextField()), |
118 | 41 | ('account', models.ForeignKey(to='identityprovider.Account', null=True)), | 41 | ('account', models.ForeignKey(on_delete=models.CASCADE, to='identityprovider.Account', null=True)), |
119 | 42 | ], | 42 | ], |
120 | 43 | options={ | 43 | options={ |
121 | 44 | }, | 44 | }, |
122 | 45 | 45 | ||
123 | === modified file 'src/identityprovider/models/account.py' | |||
124 | --- src/identityprovider/models/account.py 2018-02-15 11:27:21 +0000 | |||
125 | +++ src/identityprovider/models/account.py 2018-05-25 18:10:37 +0000 | |||
126 | @@ -700,7 +700,8 @@ | |||
127 | 700 | 700 | ||
128 | 701 | 701 | ||
129 | 702 | class AccountPassword(models.Model): | 702 | class AccountPassword(models.Model): |
131 | 703 | account = models.OneToOneField(Account, db_column=b'account') | 703 | account = models.OneToOneField( |
132 | 704 | Account, db_column=b'account', on_delete=models.CASCADE) | ||
133 | 704 | password = PasswordField() | 705 | password = PasswordField() |
134 | 705 | last_leak_check = models.DateTimeField(null=True) | 706 | last_leak_check = models.DateTimeField(null=True) |
135 | 706 | date_changed = models.DateTimeField(null=True, editable=False) | 707 | date_changed = models.DateTimeField(null=True, editable=False) |
136 | @@ -737,7 +738,7 @@ | |||
137 | 737 | 738 | ||
138 | 738 | class Token(models.Model): | 739 | class Token(models.Model): |
139 | 739 | 740 | ||
141 | 740 | consumer = models.ForeignKey(Account) | 741 | consumer = models.ForeignKey(Account, on_delete=models.CASCADE) |
142 | 741 | name = models.TextField() | 742 | name = models.TextField() |
143 | 742 | scope = models.TextField( | 743 | scope = models.TextField( |
144 | 743 | choices=TokenScope._get_choices(), default=TokenScope.VERSION_2) | 744 | choices=TokenScope._get_choices(), default=TokenScope.VERSION_2) |
145 | 744 | 745 | ||
146 | === modified file 'src/identityprovider/models/authlog.py' | |||
147 | --- src/identityprovider/models/authlog.py 2015-09-15 22:30:26 +0000 | |||
148 | +++ src/identityprovider/models/authlog.py 2018-05-25 18:10:37 +0000 | |||
149 | @@ -23,7 +23,7 @@ | |||
150 | 23 | # EmailField, so we can 1) accept input longer than 255 chars, and 2) | 23 | # EmailField, so we can 1) accept input longer than 255 chars, and 2) |
151 | 24 | # accept input that's not valid e-mail addresses (we want to log that). | 24 | # accept input that's not valid e-mail addresses (we want to log that). |
152 | 25 | login_email = models.TextField(default='', null=False) | 25 | login_email = models.TextField(default='', null=False) |
154 | 26 | account = models.ForeignKey(Account, null=True) | 26 | account = models.ForeignKey(Account, null=True, on_delete=models.CASCADE) |
155 | 27 | referer = models.TextField() | 27 | referer = models.TextField() |
156 | 28 | remote_ip = models.GenericIPAddressField() | 28 | remote_ip = models.GenericIPAddressField() |
157 | 29 | user_agent = models.TextField() | 29 | user_agent = models.TextField() |
158 | 30 | 30 | ||
159 | === modified file 'src/identityprovider/models/authtoken.py' | |||
160 | --- src/identityprovider/models/authtoken.py 2017-06-08 20:45:08 +0000 | |||
161 | +++ src/identityprovider/models/authtoken.py 2018-05-25 18:10:37 +0000 | |||
162 | @@ -102,7 +102,8 @@ | |||
163 | 102 | token_type = models.IntegerField(choices=AuthTokenType._get_choices()) | 102 | token_type = models.IntegerField(choices=AuthTokenType._get_choices()) |
164 | 103 | hashed_token = models.TextField(unique=True, db_column=b'token') | 103 | hashed_token = models.TextField(unique=True, db_column=b'token') |
165 | 104 | requester = models.ForeignKey( | 104 | requester = models.ForeignKey( |
167 | 105 | Account, db_column=b'requester', null=True, blank=True) | 105 | Account, db_column=b'requester', null=True, |
168 | 106 | on_delete=models.CASCADE, blank=True) | ||
169 | 106 | requester_email = models.TextField(null=True, blank=True) | 107 | requester_email = models.TextField(null=True, blank=True) |
170 | 107 | email = models.TextField(db_index=True, validators=[validate_email]) | 108 | email = models.TextField(db_index=True, validators=[validate_email]) |
171 | 108 | redirection_url = models.TextField(null=True, blank=True) | 109 | redirection_url = models.TextField(null=True, blank=True) |
172 | 109 | 110 | ||
173 | === modified file 'src/identityprovider/models/emailaddress.py' | |||
174 | --- src/identityprovider/models/emailaddress.py 2018-05-09 22:00:09 +0000 | |||
175 | +++ src/identityprovider/models/emailaddress.py 2018-05-25 18:10:37 +0000 | |||
176 | @@ -41,7 +41,8 @@ | |||
177 | 41 | date_created = models.DateTimeField( | 41 | date_created = models.DateTimeField( |
178 | 42 | default=now, blank=True, editable=False) | 42 | default=now, blank=True, editable=False) |
179 | 43 | account = models.ForeignKey( | 43 | account = models.ForeignKey( |
181 | 44 | Account, db_column=b'account', blank=True, null=True) | 44 | Account, db_column=b'account', blank=True, |
182 | 45 | null=True, on_delete=models.CASCADE) | ||
183 | 45 | 46 | ||
184 | 46 | objects = EmailAddressManager.from_queryset(EmailAddressQuerySet)() | 47 | objects = EmailAddressManager.from_queryset(EmailAddressQuerySet)() |
185 | 47 | 48 | ||
186 | @@ -96,7 +97,8 @@ | |||
187 | 96 | default=now, blank=True, editable=False) | 97 | default=now, blank=True, editable=False) |
188 | 97 | date_invalidated = models.DateTimeField(default=now, null=True, blank=True) | 98 | date_invalidated = models.DateTimeField(default=now, null=True, blank=True) |
189 | 98 | account = models.ForeignKey( | 99 | account = models.ForeignKey( |
191 | 99 | Account, db_column=b'account', blank=True, null=True) | 100 | Account, db_column=b'account', blank=True, |
192 | 101 | null=True, on_delete=models.CASCADE) | ||
193 | 100 | account_notified = models.BooleanField(default=False) | 102 | account_notified = models.BooleanField(default=False) |
194 | 101 | 103 | ||
195 | 102 | class Meta: | 104 | class Meta: |
196 | 103 | 105 | ||
197 | === modified file 'src/identityprovider/models/openidmodels.py' | |||
198 | --- src/identityprovider/models/openidmodels.py 2018-02-09 20:56:16 +0000 | |||
199 | +++ src/identityprovider/models/openidmodels.py 2018-05-25 18:10:37 +0000 | |||
200 | @@ -87,7 +87,8 @@ | |||
201 | 87 | 87 | ||
202 | 88 | 88 | ||
203 | 89 | class OpenIDAuthorization(models.Model): | 89 | class OpenIDAuthorization(models.Model): |
205 | 90 | account = models.ForeignKey(Account, db_column=b'account') | 90 | account = models.ForeignKey( |
206 | 91 | Account, db_column=b'account', on_delete=models.CASCADE) | ||
207 | 91 | client_id = models.TextField(blank=True, null=True) | 92 | client_id = models.TextField(blank=True, null=True) |
208 | 92 | date_created = models.DateTimeField( | 93 | date_created = models.DateTimeField( |
209 | 93 | default=now, blank=True, editable=False) | 94 | default=now, blank=True, editable=False) |
210 | @@ -228,7 +229,8 @@ | |||
211 | 228 | 229 | ||
212 | 229 | 230 | ||
213 | 230 | class OpenIDRPSummary(models.Model): | 231 | class OpenIDRPSummary(models.Model): |
215 | 231 | account = models.ForeignKey(Account, db_column=b'account') | 232 | account = models.ForeignKey( |
216 | 233 | Account, db_column=b'account', on_delete=models.CASCADE) | ||
217 | 232 | openid_identifier = models.TextField(db_index=True) | 234 | openid_identifier = models.TextField(db_index=True) |
218 | 233 | trust_root = models.TextField(db_index=True) | 235 | trust_root = models.TextField(db_index=True) |
219 | 234 | date_created = models.DateTimeField( | 236 | date_created = models.DateTimeField( |
220 | 235 | 237 | ||
221 | === modified file 'src/identityprovider/models/person.py' | |||
222 | --- src/identityprovider/models/person.py 2018-02-09 15:07:55 +0000 | |||
223 | +++ src/identityprovider/models/person.py 2018-05-25 18:10:37 +0000 | |||
224 | @@ -161,7 +161,8 @@ | |||
225 | 161 | 161 | ||
226 | 162 | class PersonLocation(models.Model): | 162 | class PersonLocation(models.Model): |
227 | 163 | date_created = models.DateTimeField(null=True) | 163 | date_created = models.DateTimeField(null=True) |
229 | 164 | person = models.OneToOneField(Person, db_column=b'person', null=True) | 164 | person = models.OneToOneField( |
230 | 165 | Person, db_column=b'person', null=True, on_delete=models.CASCADE) | ||
231 | 165 | latitude = models.FloatField(null=True, blank=True) | 166 | latitude = models.FloatField(null=True, blank=True) |
232 | 166 | longitude = models.FloatField(null=True, blank=True) | 167 | longitude = models.FloatField(null=True, blank=True) |
233 | 167 | time_zone = models.TextField(null=True, blank=True) | 168 | time_zone = models.TextField(null=True, blank=True) |
234 | @@ -177,9 +178,11 @@ | |||
235 | 177 | 178 | ||
236 | 178 | 179 | ||
237 | 179 | class TeamParticipation(models.Model): | 180 | class TeamParticipation(models.Model): |
241 | 180 | team = models.ForeignKey(Person, db_column=b'team', null=True, | 181 | team = models.ForeignKey( |
242 | 181 | related_name='team_participations') | 182 | Person, db_column=b'team', null=True, |
243 | 182 | person = models.ForeignKey(Person, db_column=b'person', null=True) | 183 | on_delete=models.CASCADE, related_name='team_participations') |
244 | 184 | person = models.ForeignKey( | ||
245 | 185 | Person, db_column=b'person', null=True, on_delete=models.CASCADE) | ||
246 | 183 | 186 | ||
247 | 184 | class Meta: | 187 | class Meta: |
248 | 185 | app_label = 'identityprovider' | 188 | app_label = 'identityprovider' |
249 | 186 | 189 | ||
250 | === modified file 'src/identityprovider/models/twofactor.py' | |||
251 | --- src/identityprovider/models/twofactor.py 2018-02-09 20:56:16 +0000 | |||
252 | +++ src/identityprovider/models/twofactor.py 2018-05-25 18:10:37 +0000 | |||
253 | @@ -128,7 +128,8 @@ | |||
254 | 128 | 128 | ||
255 | 129 | 129 | ||
256 | 130 | class AuthenticationDevice(models.Model): | 130 | class AuthenticationDevice(models.Model): |
258 | 131 | account = models.ForeignKey(Account, related_name='devices') | 131 | account = models.ForeignKey( |
259 | 132 | Account, on_delete=models.CASCADE, related_name='devices') | ||
260 | 132 | key = models.TextField() | 133 | key = models.TextField() |
261 | 133 | name = models.TextField() | 134 | name = models.TextField() |
262 | 134 | counter = models.IntegerField(default=0) | 135 | counter = models.IntegerField(default=0) |
263 | 135 | 136 | ||
264 | === modified file 'src/oauth_backend/migrations/0001_initial.py' | |||
265 | --- src/oauth_backend/migrations/0001_initial.py 2015-09-22 14:47:30 +0000 | |||
266 | +++ src/oauth_backend/migrations/0001_initial.py 2018-05-25 18:10:37 +0000 | |||
267 | @@ -21,7 +21,7 @@ | |||
268 | 21 | ('secret', models.CharField(default=oauth_backend.models.generate_random_string_secret, max_length=255, blank=True)), | 21 | ('secret', models.CharField(default=oauth_backend.models.generate_random_string_secret, max_length=255, blank=True)), |
269 | 22 | ('created_at', models.DateTimeField(auto_now_add=True)), | 22 | ('created_at', models.DateTimeField(auto_now_add=True)), |
270 | 23 | ('updated_at', models.DateTimeField(auto_now=True)), | 23 | ('updated_at', models.DateTimeField(auto_now=True)), |
272 | 24 | ('user', models.OneToOneField(related_name='oauth_consumer', to=settings.AUTH_USER_MODEL)), | 24 | ('user', models.OneToOneField(related_name='oauth_consumer', on_delete=models.CASCADE, to=settings.AUTH_USER_MODEL)), |
273 | 25 | ], | 25 | ], |
274 | 26 | options={ | 26 | options={ |
275 | 27 | 'db_table': 'oauth_consumer', | 27 | 'db_table': 'oauth_consumer', |
276 | @@ -34,7 +34,7 @@ | |||
277 | 34 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), | 34 | ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), |
278 | 35 | ('nonce', models.CharField(max_length=255, editable=False)), | 35 | ('nonce', models.CharField(max_length=255, editable=False)), |
279 | 36 | ('created_at', models.DateTimeField(auto_now_add=True)), | 36 | ('created_at', models.DateTimeField(auto_now_add=True)), |
281 | 37 | ('consumer', models.ForeignKey(to='oauth_backend.Consumer')), | 37 | ('consumer', models.ForeignKey(on_delete=models.CASCADE, to='oauth_backend.Consumer')), |
282 | 38 | ], | 38 | ], |
283 | 39 | options={ | 39 | options={ |
284 | 40 | 'db_table': 'oauth_nonce', | 40 | 'db_table': 'oauth_nonce', |
285 | @@ -49,7 +49,7 @@ | |||
286 | 49 | ('name', models.CharField(max_length=255, blank=True)), | 49 | ('name', models.CharField(max_length=255, blank=True)), |
287 | 50 | ('created_at', models.DateTimeField(default=django.utils.timezone.now)), | 50 | ('created_at', models.DateTimeField(default=django.utils.timezone.now)), |
288 | 51 | ('updated_at', models.DateTimeField(default=django.utils.timezone.now)), | 51 | ('updated_at', models.DateTimeField(default=django.utils.timezone.now)), |
290 | 52 | ('consumer', models.ForeignKey(to='oauth_backend.Consumer')), | 52 | ('consumer', models.ForeignKey(on_delete=models.CASCADE, to='oauth_backend.Consumer')), |
291 | 53 | ], | 53 | ], |
292 | 54 | options={ | 54 | options={ |
293 | 55 | 'db_table': 'oauth_token', | 55 | 'db_table': 'oauth_token', |
294 | @@ -59,7 +59,7 @@ | |||
295 | 59 | migrations.AddField( | 59 | migrations.AddField( |
296 | 60 | model_name='nonce', | 60 | model_name='nonce', |
297 | 61 | name='token', | 61 | name='token', |
299 | 62 | field=models.ForeignKey(to='oauth_backend.Token'), | 62 | field=models.ForeignKey(on_delete=models.CASCADE, to='oauth_backend.Token'), |
300 | 63 | preserve_default=True, | 63 | preserve_default=True, |
301 | 64 | ), | 64 | ), |
302 | 65 | migrations.AlterUniqueTogether( | 65 | migrations.AlterUniqueTogether( |
303 | 66 | 66 | ||
304 | === modified file 'src/oauth_backend/models.py' | |||
305 | --- src/oauth_backend/models.py 2015-09-22 16:11:08 +0000 | |||
306 | +++ src/oauth_backend/models.py 2018-05-25 18:10:37 +0000 | |||
307 | @@ -44,7 +44,8 @@ | |||
308 | 44 | class Consumer(models.Model): | 44 | class Consumer(models.Model): |
309 | 45 | """An OAuth consumer (client).""" | 45 | """An OAuth consumer (client).""" |
310 | 46 | 46 | ||
312 | 47 | user = models.OneToOneField(User, related_name='oauth_consumer') | 47 | user = models.OneToOneField( |
313 | 48 | User, on_delete=models.CASCADE, related_name='oauth_consumer') | ||
314 | 48 | 49 | ||
315 | 49 | secret = models.CharField( | 50 | secret = models.CharField( |
316 | 50 | max_length=255, blank=True, default=generate_random_string_secret, | 51 | max_length=255, blank=True, default=generate_random_string_secret, |
317 | @@ -67,7 +68,7 @@ | |||
318 | 67 | class Token(models.Model): | 68 | class Token(models.Model): |
319 | 68 | """An OAuth access token.""" | 69 | """An OAuth access token.""" |
320 | 69 | 70 | ||
322 | 70 | consumer = models.ForeignKey(Consumer) | 71 | consumer = models.ForeignKey(Consumer, on_delete=models.CASCADE) |
323 | 71 | 72 | ||
324 | 72 | token = models.CharField( | 73 | token = models.CharField( |
325 | 73 | max_length=TOKEN_LENGTH, default=generate_random_string_token, | 74 | max_length=TOKEN_LENGTH, default=generate_random_string_token, |
+1, thanks!