Skip to content

Commit e4e5c35

Browse files
committed
refactor(idp): prepare models for DCR
1 parent 5d34eb1 commit e4e5c35

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

allauth/idp/oidc/migrations/0001_initial.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ class Migration(migrations.Migration):
125125
"type",
126126
models.CharField(
127127
choices=[
128+
("ia", "Initial access token"),
128129
("at", "Access token"),
129130
("rt", "Refresh token"),
130131
("ac", "Authorization code"),
@@ -143,6 +144,8 @@ class Migration(migrations.Migration):
143144
(
144145
"client",
145146
models.ForeignKey(
147+
blank=True,
148+
null=True,
146149
on_delete=django.db.models.deletion.CASCADE,
147150
to="allauth_idp_oidc.client",
148151
),

allauth/idp/oidc/models.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,13 +156,14 @@ class Token(models.Model):
156156
objects = TokenQuerySet.as_manager()
157157

158158
class Type(models.TextChoices):
159+
INITIAL_ACCESS_TOKEN = "ia", "Initial access token"
159160
ACCESS_TOKEN = "at", "Access token"
160161
REFRESH_TOKEN = "rt", "Refresh token"
161162
AUTHORIZATION_CODE = "ac", "Authorization code"
162163

163164
type = models.CharField(max_length=2, choices=Type.choices)
164165
hash = models.CharField(max_length=255)
165-
client = models.ForeignKey(Client, on_delete=models.CASCADE)
166+
client = models.ForeignKey(Client, on_delete=models.CASCADE, blank=True, null=True)
166167
user = models.ForeignKey(
167168
settings.AUTH_USER_MODEL, on_delete=models.CASCADE, blank=True, null=True
168169
)

0 commit comments

Comments
 (0)