Merge lp:~roadmr/canonical-identity-provider/fix-deprecation-warnings-1 into lp:canonical-identity-provider/release

Proposed by Daniel Manrique on 2018-05-25
Status: Merged
Approved by: Daniel Manrique on 2018-05-25
Approved revision: no longer in the revision history of 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
Reviewer Review Type Date Requested Status
Maximiliano Bertacchini 2018-05-25 Approve on 2018-05-25
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.
Maximiliano Bertacchini (maxiberta) wrote :

+1, thanks!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Makefile'
--- Makefile 2018-04-16 21:22:24 +0000
+++ Makefile 2018-05-25 18:10:37 +0000
@@ -11,7 +11,7 @@
11LOCAL_SETTINGS_DIR ?= $(CURDIR)/../local_config11LOCAL_SETTINGS_DIR ?= $(CURDIR)/../local_config
12LOCAL_SETTINGS_PATH = $(LOCAL_SETTINGS_DIR)/settings.py12LOCAL_SETTINGS_PATH = $(LOCAL_SETTINGS_DIR)/settings.py
13FLAKE8 = $(ENV)/bin/flake813FLAKE8 = $(ENV)/bin/flake8
14PYTHON = $(ENV)/bin/python -Wd14PYTHON = $(ENV)/bin/python -Wd -Wignore:"Not importing":ImportWarning
15PIP = $(PYTHON) $(ENV)/bin/pip15PIP = $(PYTHON) $(ENV)/bin/pip
16SRC_DIR = $(CURDIR)/src16SRC_DIR = $(CURDIR)/src
17LIB_DIR = $(CURDIR)/lib17LIB_DIR = $(CURDIR)/lib
1818
=== modified file 'src/identityprovider/migrations/0001_initial.py'
--- src/identityprovider/migrations/0001_initial.py 2015-06-26 16:21:26 +0000
+++ src/identityprovider/migrations/0001_initial.py 2018-05-25 18:10:37 +0000
@@ -69,7 +69,7 @@
69 fields=[69 fields=[
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)),
71 ('password', identityprovider.models.account.PasswordField()),71 ('password', identityprovider.models.account.PasswordField()),
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')),
73 ],73 ],
74 options={74 options={
75 'db_table': 'accountpassword',75 'db_table': 'accountpassword',
@@ -102,7 +102,7 @@
102 ('name', models.TextField()),102 ('name', models.TextField()),
103 ('counter', models.IntegerField(default=0)),103 ('counter', models.IntegerField(default=0)),
104 ('device_type', models.TextField(null=True)),104 ('device_type', models.TextField(null=True)),
105 ('account', models.ForeignKey(related_name='devices', to='identityprovider.Account')),105 ('account', models.ForeignKey(related_name='devices', on_delete=models.CASCADE, to='identityprovider.Account')),
106 ],106 ],
107 options={107 options={
108 'ordering': ('id',),108 'ordering': ('id',),
@@ -122,7 +122,7 @@
122 ('redirection_url', models.TextField(null=True, blank=True)),122 ('redirection_url', models.TextField(null=True, blank=True)),
123 ('displayname', identityprovider.models.account.DisplaynameField(null=True, blank=True)),123 ('displayname', identityprovider.models.account.DisplaynameField(null=True, blank=True)),
124 ('password', identityprovider.models.account.PasswordField(null=True, blank=True)),124 ('password', identityprovider.models.account.PasswordField(null=True, blank=True)),
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)),
126 ],126 ],
127 options={127 options={
128 'db_table': 'authtoken',128 'db_table': 'authtoken',
@@ -137,7 +137,7 @@
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)),
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')])),
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)),
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)),
141 ],141 ],
142 options={142 options={
143 'db_table': 'emailaddress',143 'db_table': 'emailaddress',
@@ -153,7 +153,7 @@
153 ('date_created', models.DateTimeField(editable=False, blank=True)),153 ('date_created', models.DateTimeField(editable=False, blank=True)),
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)),
155 ('account_notified', models.BooleanField(default=False)),155 ('account_notified', models.BooleanField(default=False)),
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)),
157 ],157 ],
158 options={158 options={
159 'db_table': 'invalidated_emailaddress',159 'db_table': 'invalidated_emailaddress',
@@ -212,7 +212,7 @@
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)),
213 ('date_expires', models.DateTimeField()),213 ('date_expires', models.DateTimeField()),
214 ('trust_root', models.TextField()),214 ('trust_root', models.TextField()),
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')),
216 ],216 ],
217 options={217 options={
218 'db_table': 'openidauthorization',218 'db_table': 'openidauthorization',
@@ -268,7 +268,7 @@
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)),
269 ('total_logins', models.IntegerField(default=1)),269 ('total_logins', models.IntegerField(default=1)),
270 ('approved_data', models.TextField(default='', null=True, blank=True)),270 ('approved_data', models.TextField(default='', null=True, blank=True)),
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')),
272 ],272 ],
273 options={273 options={
274 'db_table': 'openidrpsummary',274 'db_table': 'openidrpsummary',
@@ -333,7 +333,7 @@
333 ('date_last_modified', models.DateTimeField(null=True)),333 ('date_last_modified', models.DateTimeField(null=True)),
334 ('visible', models.NullBooleanField(default=True)),334 ('visible', models.NullBooleanField(default=True)),
335 ('locked', models.NullBooleanField(default=False)),335 ('locked', models.NullBooleanField(default=False)),
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')),
337 ],337 ],
338 options={338 options={
339 'db_table': 'lp_personlocation',339 'db_table': 'lp_personlocation',
@@ -344,8 +344,8 @@
344 name='TeamParticipation',344 name='TeamParticipation',
345 fields=[345 fields=[
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)),
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)),
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)),
349 ],349 ],
350 options={350 options={
351 'db_table': 'lp_teamparticipation',351 'db_table': 'lp_teamparticipation',
@@ -361,7 +361,7 @@
361 ('secret', models.TextField(default=identityprovider.utils.generate_random_string_len_70)),361 ('secret', models.TextField(default=identityprovider.utils.generate_random_string_len_70)),
362 ('date_created', models.DateTimeField(default=django.utils.timezone.now)),362 ('date_created', models.DateTimeField(default=django.utils.timezone.now)),
363 ('date_updated', models.DateTimeField(default=django.utils.timezone.now)),363 ('date_updated', models.DateTimeField(default=django.utils.timezone.now)),
364 ('consumer', models.ForeignKey(to='identityprovider.Account')),364 ('consumer', models.ForeignKey(on_delete=models.CASCADE, to='identityprovider.Account')),
365 ],365 ],
366 options={366 options={
367 },367 },
368368
=== modified file 'src/identityprovider/migrations/0005_authlog.py'
--- src/identityprovider/migrations/0005_authlog.py 2015-12-10 20:27:28 +0000
+++ src/identityprovider/migrations/0005_authlog.py 2018-05-25 18:10:37 +0000
@@ -38,7 +38,7 @@
38 ('referer', models.TextField()),38 ('referer', models.TextField()),
39 ('remote_ip', models.GenericIPAddressField()),39 ('remote_ip', models.GenericIPAddressField()),
40 ('user_agent', models.TextField()),40 ('user_agent', models.TextField()),
41 ('account', models.ForeignKey(to='identityprovider.Account', null=True)),41 ('account', models.ForeignKey(on_delete=models.CASCADE, to='identityprovider.Account', null=True)),
42 ],42 ],
43 options={43 options={
44 },44 },
4545
=== modified file 'src/identityprovider/models/account.py'
--- src/identityprovider/models/account.py 2018-02-15 11:27:21 +0000
+++ src/identityprovider/models/account.py 2018-05-25 18:10:37 +0000
@@ -700,7 +700,8 @@
700700
701701
702class AccountPassword(models.Model):702class AccountPassword(models.Model):
703 account = models.OneToOneField(Account, db_column=b'account')703 account = models.OneToOneField(
704 Account, db_column=b'account', on_delete=models.CASCADE)
704 password = PasswordField()705 password = PasswordField()
705 last_leak_check = models.DateTimeField(null=True)706 last_leak_check = models.DateTimeField(null=True)
706 date_changed = models.DateTimeField(null=True, editable=False)707 date_changed = models.DateTimeField(null=True, editable=False)
@@ -737,7 +738,7 @@
737738
738class Token(models.Model):739class Token(models.Model):
739740
740 consumer = models.ForeignKey(Account)741 consumer = models.ForeignKey(Account, on_delete=models.CASCADE)
741 name = models.TextField()742 name = models.TextField()
742 scope = models.TextField(743 scope = models.TextField(
743 choices=TokenScope._get_choices(), default=TokenScope.VERSION_2)744 choices=TokenScope._get_choices(), default=TokenScope.VERSION_2)
744745
=== modified file 'src/identityprovider/models/authlog.py'
--- src/identityprovider/models/authlog.py 2015-09-15 22:30:26 +0000
+++ src/identityprovider/models/authlog.py 2018-05-25 18:10:37 +0000
@@ -23,7 +23,7 @@
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)
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).
25 login_email = models.TextField(default='', null=False)25 login_email = models.TextField(default='', null=False)
26 account = models.ForeignKey(Account, null=True)26 account = models.ForeignKey(Account, null=True, on_delete=models.CASCADE)
27 referer = models.TextField()27 referer = models.TextField()
28 remote_ip = models.GenericIPAddressField()28 remote_ip = models.GenericIPAddressField()
29 user_agent = models.TextField()29 user_agent = models.TextField()
3030
=== modified file 'src/identityprovider/models/authtoken.py'
--- src/identityprovider/models/authtoken.py 2017-06-08 20:45:08 +0000
+++ src/identityprovider/models/authtoken.py 2018-05-25 18:10:37 +0000
@@ -102,7 +102,8 @@
102 token_type = models.IntegerField(choices=AuthTokenType._get_choices())102 token_type = models.IntegerField(choices=AuthTokenType._get_choices())
103 hashed_token = models.TextField(unique=True, db_column=b'token')103 hashed_token = models.TextField(unique=True, db_column=b'token')
104 requester = models.ForeignKey(104 requester = models.ForeignKey(
105 Account, db_column=b'requester', null=True, blank=True)105 Account, db_column=b'requester', null=True,
106 on_delete=models.CASCADE, blank=True)
106 requester_email = models.TextField(null=True, blank=True)107 requester_email = models.TextField(null=True, blank=True)
107 email = models.TextField(db_index=True, validators=[validate_email])108 email = models.TextField(db_index=True, validators=[validate_email])
108 redirection_url = models.TextField(null=True, blank=True)109 redirection_url = models.TextField(null=True, blank=True)
109110
=== modified file 'src/identityprovider/models/emailaddress.py'
--- src/identityprovider/models/emailaddress.py 2018-05-09 22:00:09 +0000
+++ src/identityprovider/models/emailaddress.py 2018-05-25 18:10:37 +0000
@@ -41,7 +41,8 @@
41 date_created = models.DateTimeField(41 date_created = models.DateTimeField(
42 default=now, blank=True, editable=False)42 default=now, blank=True, editable=False)
43 account = models.ForeignKey(43 account = models.ForeignKey(
44 Account, db_column=b'account', blank=True, null=True)44 Account, db_column=b'account', blank=True,
45 null=True, on_delete=models.CASCADE)
4546
46 objects = EmailAddressManager.from_queryset(EmailAddressQuerySet)()47 objects = EmailAddressManager.from_queryset(EmailAddressQuerySet)()
4748
@@ -96,7 +97,8 @@
96 default=now, blank=True, editable=False)97 default=now, blank=True, editable=False)
97 date_invalidated = models.DateTimeField(default=now, null=True, blank=True)98 date_invalidated = models.DateTimeField(default=now, null=True, blank=True)
98 account = models.ForeignKey(99 account = models.ForeignKey(
99 Account, db_column=b'account', blank=True, null=True)100 Account, db_column=b'account', blank=True,
101 null=True, on_delete=models.CASCADE)
100 account_notified = models.BooleanField(default=False)102 account_notified = models.BooleanField(default=False)
101103
102 class Meta:104 class Meta:
103105
=== modified file 'src/identityprovider/models/openidmodels.py'
--- src/identityprovider/models/openidmodels.py 2018-02-09 20:56:16 +0000
+++ src/identityprovider/models/openidmodels.py 2018-05-25 18:10:37 +0000
@@ -87,7 +87,8 @@
8787
8888
89class OpenIDAuthorization(models.Model):89class OpenIDAuthorization(models.Model):
90 account = models.ForeignKey(Account, db_column=b'account')90 account = models.ForeignKey(
91 Account, db_column=b'account', on_delete=models.CASCADE)
91 client_id = models.TextField(blank=True, null=True)92 client_id = models.TextField(blank=True, null=True)
92 date_created = models.DateTimeField(93 date_created = models.DateTimeField(
93 default=now, blank=True, editable=False)94 default=now, blank=True, editable=False)
@@ -228,7 +229,8 @@
228229
229230
230class OpenIDRPSummary(models.Model):231class OpenIDRPSummary(models.Model):
231 account = models.ForeignKey(Account, db_column=b'account')232 account = models.ForeignKey(
233 Account, db_column=b'account', on_delete=models.CASCADE)
232 openid_identifier = models.TextField(db_index=True)234 openid_identifier = models.TextField(db_index=True)
233 trust_root = models.TextField(db_index=True)235 trust_root = models.TextField(db_index=True)
234 date_created = models.DateTimeField(236 date_created = models.DateTimeField(
235237
=== modified file 'src/identityprovider/models/person.py'
--- src/identityprovider/models/person.py 2018-02-09 15:07:55 +0000
+++ src/identityprovider/models/person.py 2018-05-25 18:10:37 +0000
@@ -161,7 +161,8 @@
161161
162class PersonLocation(models.Model):162class PersonLocation(models.Model):
163 date_created = models.DateTimeField(null=True)163 date_created = models.DateTimeField(null=True)
164 person = models.OneToOneField(Person, db_column=b'person', null=True)164 person = models.OneToOneField(
165 Person, db_column=b'person', null=True, on_delete=models.CASCADE)
165 latitude = models.FloatField(null=True, blank=True)166 latitude = models.FloatField(null=True, blank=True)
166 longitude = models.FloatField(null=True, blank=True)167 longitude = models.FloatField(null=True, blank=True)
167 time_zone = models.TextField(null=True, blank=True)168 time_zone = models.TextField(null=True, blank=True)
@@ -177,9 +178,11 @@
177178
178179
179class TeamParticipation(models.Model):180class TeamParticipation(models.Model):
180 team = models.ForeignKey(Person, db_column=b'team', null=True,181 team = models.ForeignKey(
181 related_name='team_participations')182 Person, db_column=b'team', null=True,
182 person = models.ForeignKey(Person, db_column=b'person', null=True)183 on_delete=models.CASCADE, related_name='team_participations')
184 person = models.ForeignKey(
185 Person, db_column=b'person', null=True, on_delete=models.CASCADE)
183186
184 class Meta:187 class Meta:
185 app_label = 'identityprovider'188 app_label = 'identityprovider'
186189
=== modified file 'src/identityprovider/models/twofactor.py'
--- src/identityprovider/models/twofactor.py 2018-02-09 20:56:16 +0000
+++ src/identityprovider/models/twofactor.py 2018-05-25 18:10:37 +0000
@@ -128,7 +128,8 @@
128128
129129
130class AuthenticationDevice(models.Model):130class AuthenticationDevice(models.Model):
131 account = models.ForeignKey(Account, related_name='devices')131 account = models.ForeignKey(
132 Account, on_delete=models.CASCADE, related_name='devices')
132 key = models.TextField()133 key = models.TextField()
133 name = models.TextField()134 name = models.TextField()
134 counter = models.IntegerField(default=0)135 counter = models.IntegerField(default=0)
135136
=== modified file 'src/oauth_backend/migrations/0001_initial.py'
--- src/oauth_backend/migrations/0001_initial.py 2015-09-22 14:47:30 +0000
+++ src/oauth_backend/migrations/0001_initial.py 2018-05-25 18:10:37 +0000
@@ -21,7 +21,7 @@
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)),
22 ('created_at', models.DateTimeField(auto_now_add=True)),22 ('created_at', models.DateTimeField(auto_now_add=True)),
23 ('updated_at', models.DateTimeField(auto_now=True)),23 ('updated_at', models.DateTimeField(auto_now=True)),
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)),
25 ],25 ],
26 options={26 options={
27 'db_table': 'oauth_consumer',27 'db_table': 'oauth_consumer',
@@ -34,7 +34,7 @@
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)),
35 ('nonce', models.CharField(max_length=255, editable=False)),35 ('nonce', models.CharField(max_length=255, editable=False)),
36 ('created_at', models.DateTimeField(auto_now_add=True)),36 ('created_at', models.DateTimeField(auto_now_add=True)),
37 ('consumer', models.ForeignKey(to='oauth_backend.Consumer')),37 ('consumer', models.ForeignKey(on_delete=models.CASCADE, to='oauth_backend.Consumer')),
38 ],38 ],
39 options={39 options={
40 'db_table': 'oauth_nonce',40 'db_table': 'oauth_nonce',
@@ -49,7 +49,7 @@
49 ('name', models.CharField(max_length=255, blank=True)),49 ('name', models.CharField(max_length=255, blank=True)),
50 ('created_at', models.DateTimeField(default=django.utils.timezone.now)),50 ('created_at', models.DateTimeField(default=django.utils.timezone.now)),
51 ('updated_at', models.DateTimeField(default=django.utils.timezone.now)),51 ('updated_at', models.DateTimeField(default=django.utils.timezone.now)),
52 ('consumer', models.ForeignKey(to='oauth_backend.Consumer')),52 ('consumer', models.ForeignKey(on_delete=models.CASCADE, to='oauth_backend.Consumer')),
53 ],53 ],
54 options={54 options={
55 'db_table': 'oauth_token',55 'db_table': 'oauth_token',
@@ -59,7 +59,7 @@
59 migrations.AddField(59 migrations.AddField(
60 model_name='nonce',60 model_name='nonce',
61 name='token',61 name='token',
62 field=models.ForeignKey(to='oauth_backend.Token'),62 field=models.ForeignKey(on_delete=models.CASCADE, to='oauth_backend.Token'),
63 preserve_default=True,63 preserve_default=True,
64 ),64 ),
65 migrations.AlterUniqueTogether(65 migrations.AlterUniqueTogether(
6666
=== modified file 'src/oauth_backend/models.py'
--- src/oauth_backend/models.py 2015-09-22 16:11:08 +0000
+++ src/oauth_backend/models.py 2018-05-25 18:10:37 +0000
@@ -44,7 +44,8 @@
44class Consumer(models.Model):44class Consumer(models.Model):
45 """An OAuth consumer (client)."""45 """An OAuth consumer (client)."""
4646
47 user = models.OneToOneField(User, related_name='oauth_consumer')47 user = models.OneToOneField(
48 User, on_delete=models.CASCADE, related_name='oauth_consumer')
4849
49 secret = models.CharField(50 secret = models.CharField(
50 max_length=255, blank=True, default=generate_random_string_secret,51 max_length=255, blank=True, default=generate_random_string_secret,
@@ -67,7 +68,7 @@
67class Token(models.Model):68class Token(models.Model):
68 """An OAuth access token."""69 """An OAuth access token."""
6970
70 consumer = models.ForeignKey(Consumer)71 consumer = models.ForeignKey(Consumer, on_delete=models.CASCADE)
7172
72 token = models.CharField(73 token = models.CharField(
73 max_length=TOKEN_LENGTH, default=generate_random_string_token,74 max_length=TOKEN_LENGTH, default=generate_random_string_token,