Skip to content

Commit

Permalink
refactor(models): move secret field
Browse files Browse the repository at this point in the history
  • Loading branch information
thekaveman committed Jan 28, 2025
1 parent f39f3ce commit 644a623
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
17 changes: 9 additions & 8 deletions web/oauth/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Generated by Django 5.1.4 on 2025-01-23 03:51

import uuid
import web.core.models
import web.secrets

from django.db import migrations, models

import web.oauth.models.secret_name_field
import web.oauth.secrets


class Migration(migrations.Migration):

Expand All @@ -20,10 +22,10 @@ class Migration(migrations.Migration):
("client_name", models.CharField(help_text="The name of this OAuth client", max_length=50)),
(
"client_id_secret_name",
web.core.models.SecretNameField(
web.oauth.models.secret_name_field.SecretNameField(
help_text="The name of the secret containing the client ID for this OAuth client",
max_length=127,
validators=[web.secrets.SecretNameValidator()],
validators=[web.oauth.secrets.SecretNameValidator()],
),
),
(
Expand All @@ -46,9 +48,8 @@ class Migration(migrations.Migration):
),
),
],
),
migrations.AlterModelOptions(
name="oauthclientconfig",
options={"verbose_name": "OAuth Client"},
options={
"verbose_name": "OAuth Client",
},
),
]
4 changes: 4 additions & 0 deletions web/oauth/models/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
from .config import OAuthClientConfig
from .secret_name_field import SecretNameField

__all__ = ["OAuthClientConfig", "SecretNameField"]
2 changes: 1 addition & 1 deletion web/oauth/models.py → web/oauth/models/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from django.db import models

from web.core.models import SecretNameField
from .secret_name_field import SecretNameField


class OAuthClientConfig(models.Model):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from django.db import models

from web.secrets import NAME_VALIDATOR, get_secret_by_name
from ..secrets import NAME_VALIDATOR, get_secret_by_name


class SecretNameField(models.SlugField):
Expand Down
File renamed without changes.

0 comments on commit 644a623

Please sign in to comment.