Add owner field to Client (#211)
* Add owner field to Client * Add related_name to client owner
This commit is contained in:
parent
bc3a4a2b9f
commit
6beb186540
3 changed files with 27 additions and 2 deletions
|
@ -52,8 +52,8 @@ class ClientAdmin(admin.ModelAdmin):
|
|||
fieldsets = [
|
||||
[_(u''), {
|
||||
'fields': (
|
||||
'name', 'client_type', 'response_type', '_redirect_uris', 'jwt_alg', 'require_consent',
|
||||
'reuse_consent'),
|
||||
'name', 'owner', 'client_type', 'response_type', '_redirect_uris', 'jwt_alg',
|
||||
'require_consent', 'reuse_consent'),
|
||||
}],
|
||||
[_(u'Credentials'), {
|
||||
'fields': ('client_id', 'client_secret'),
|
||||
|
@ -69,6 +69,7 @@ class ClientAdmin(admin.ModelAdmin):
|
|||
list_display = ['name', 'client_id', 'response_type', 'date_created']
|
||||
readonly_fields = ['date_created']
|
||||
search_fields = ['name']
|
||||
raw_id_fields = ['owner']
|
||||
|
||||
|
||||
@admin.register(Code)
|
||||
|
|
23
oidc_provider/migrations/0023_client_owner.py
Normal file
23
oidc_provider/migrations/0023_client_owner.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11 on 2017-11-08 21:43
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
('oidc_provider', '0022_auto_20170331_1626'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='client',
|
||||
name='owner',
|
||||
field=models.ForeignKey(blank=True, default=None, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='oidc_clients_set', to=settings.AUTH_USER_MODEL, verbose_name='Owner'),
|
||||
),
|
||||
]
|
|
@ -33,6 +33,7 @@ JWT_ALGS = [
|
|||
class Client(models.Model):
|
||||
|
||||
name = models.CharField(max_length=100, default='', verbose_name=_(u'Name'))
|
||||
owner = models.ForeignKey(settings.AUTH_USER_MODEL, verbose_name=_(u'Owner'), blank = True, null = True, default = None, on_delete=models.SET_NULL, related_name='oidc_clients_set')
|
||||
client_type = models.CharField(
|
||||
max_length=30,
|
||||
choices=CLIENT_TYPE_CHOICES,
|
||||
|
|
Loading…
Reference in a new issue