auth oidc: add slug to provider model (#26813)
This commit is contained in:
parent
90cc7cfe89
commit
f70ebc07d1
|
@ -10,11 +10,12 @@ class OIDCClaimMappingInline(admin.TabularInline):
|
|||
|
||||
|
||||
class OIDCProviderAdmin(admin.ModelAdmin):
|
||||
list_display = ['name', 'client_id', 'ou', 'created', 'modified']
|
||||
list_display = ['name', 'slug', 'client_id', 'ou', 'created', 'modified']
|
||||
inlines = [OIDCClaimMappingInline]
|
||||
list_filter = ['ou']
|
||||
date_hierarchy = 'modified'
|
||||
readonly_fields = ['created', 'modified']
|
||||
prepopulated_fields = {'slug': ('name',)}
|
||||
|
||||
|
||||
class OIDCAccountAdmin(admin.ModelAdmin):
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.12 on 2018-09-28 08:58
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('authentic2_auth_oidc', '0004_auto_20171017_1522'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='oidcprovider',
|
||||
name='slug',
|
||||
field=models.SlugField(blank=True, max_length=256, null=True, unique=True, verbose_name='slug'),
|
||||
),
|
||||
]
|
|
@ -46,6 +46,12 @@ class OIDCProvider(models.Model):
|
|||
unique=True,
|
||||
max_length=128,
|
||||
verbose_name=_('name'))
|
||||
slug = models.SlugField(
|
||||
unique=True,
|
||||
max_length=256,
|
||||
verbose_name=_('slug'),
|
||||
blank=True,
|
||||
null=True)
|
||||
issuer = models.CharField(
|
||||
max_length=256,
|
||||
verbose_name=_('issuer'),
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{% for provider in providers %}
|
||||
<p id="oidc-p-{{ provider.name|slugify }}">
|
||||
<a id="oidc-a-{{ provider.name|slugify }}"
|
||||
<p id="oidc-p-{% firstof provider.slug provider.name|slugify %}">
|
||||
<a id="oidc-a-{% firstof provider.slug provider.name|slugify %}"
|
||||
href="{% url "oidc-login" pk=provider.pk %}?{{ request.GET.urlencode }}">{{ provider.name }}</a>
|
||||
</p>
|
||||
{% endfor %}
|
||||
|
|
Loading…
Reference in New Issue