uuid as pk
This commit is contained in:
parent
fa7f080581
commit
a8154a1650
2 changed files with 15 additions and 22 deletions
|
|
@ -1,21 +0,0 @@
|
|||
# Generated by Django 5.0.6 on 2024-07-04 11:38
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('gooyal_oauth2', '0001_initial'),
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='accesstoken',
|
||||
name='client_owner',
|
||||
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL),
|
||||
),
|
||||
]
|
||||
|
|
@ -2,9 +2,11 @@
|
|||
from django.db import models
|
||||
from oauth2_provider.models import AbstractApplication, AbstractAccessToken, AbstractGrant, AbstractRefreshToken, \
|
||||
AbstractIDToken
|
||||
|
||||
import uuid
|
||||
|
||||
class AccessToken(AbstractAccessToken):
|
||||
id = None
|
||||
uuid = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4, unique=True, db_index=True)
|
||||
detail = models.JSONField(null=True, blank=True)
|
||||
client_id = models.CharField(max_length=255, null=True, blank=True)
|
||||
client_owner = models.ForeignKey('users.User', on_delete=models.PROTECT, null=True, blank=True)
|
||||
|
|
@ -14,21 +16,33 @@ class AccessToken(AbstractAccessToken):
|
|||
|
||||
|
||||
class Application(AbstractApplication):
|
||||
id = None
|
||||
uuid = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4, unique=True, db_index=True)
|
||||
|
||||
class Meta:
|
||||
abstract = False
|
||||
|
||||
|
||||
class Grant(AbstractGrant):
|
||||
id = None
|
||||
uuid = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4, unique=True, db_index=True)
|
||||
|
||||
class Meta:
|
||||
abstract = False
|
||||
|
||||
|
||||
class RefreshToken(AbstractRefreshToken):
|
||||
id = None
|
||||
uuid = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4, unique=True, db_index=True)
|
||||
|
||||
class Meta:
|
||||
abstract = False
|
||||
|
||||
|
||||
class IDToken(AbstractIDToken):
|
||||
id = None
|
||||
uuid = models.UUIDField(primary_key=True, editable=False, default=uuid.uuid4, unique=True, db_index=True)
|
||||
|
||||
class Meta:
|
||||
abstract = False
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue