Skip to content

Commit 426ea5e

Browse files
duzumakidopry
authored andcommitted
Migrations
1 parent 865b6ab commit 426ea5e

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Generated by Django 5.1.5 on 2025-01-24 14:00
2+
3+
import django.db.models.deletion
4+
from django.conf import settings
5+
from django.db import migrations, models
6+
7+
8+
class Migration(migrations.Migration):
9+
10+
dependencies = [
11+
('oauth2_provider', '0012_add_token_checksum'),
12+
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
13+
]
14+
15+
operations = [
16+
migrations.AlterField(
17+
model_name='application',
18+
name='authorization_grant_type',
19+
field=models.CharField(choices=[('authorization-code', 'Authorization code'), ('urn:ietf:params:oauth:grant-type:device_code', 'Device Code'), ('implicit', 'Implicit'), ('password', 'Resource owner password-based'), ('client-credentials', 'Client credentials'), ('openid-hybrid', 'OpenID connect hybrid')], max_length=44),
20+
),
21+
migrations.CreateModel(
22+
name='Device',
23+
fields=[
24+
('id', models.BigAutoField(primary_key=True, serialize=False)),
25+
('device_code', models.CharField(max_length=100, unique=True)),
26+
('user_code', models.CharField(max_length=100)),
27+
('scope', models.CharField(max_length=64, null=True)),
28+
('interval', models.IntegerField(default=5)),
29+
('expires', models.DateTimeField()),
30+
('status', models.CharField(blank=True, choices=[('authorized', 'Authorized'), ('authorization-pending', 'Authorization pending'), ('expired', 'Expired'), ('denied', 'Denied')], default='authorization-pending', max_length=64)),
31+
('client_id', models.CharField(db_index=True, max_length=100)),
32+
('last_checked', models.DateTimeField(auto_now=True)),
33+
('user', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='%(app_label)s_%(class)s', to=settings.AUTH_USER_MODEL)),
34+
],
35+
options={
36+
'abstract': False,
37+
'swappable': 'OAUTH2_PROVIDER_DEVICE_MODEL',
38+
'constraints': [models.UniqueConstraint(fields=('device_code',), name='oauth2_provider_device_unique_device_code')],
39+
},
40+
),
41+
]

oauth2_provider/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ class AbstractApplication(models.Model):
132132
default="",
133133
)
134134
client_type = models.CharField(max_length=32, choices=CLIENT_TYPES)
135-
authorization_grant_type = models.CharField(max_length=32, choices=GRANT_TYPES)
135+
authorization_grant_type = models.CharField(max_length=44, choices=GRANT_TYPES)
136136
client_secret = ClientSecretField(
137137
max_length=255,
138138
blank=True,

0 commit comments

Comments
 (0)