Add post_logout_redirect_uris for Client model.

This commit is contained in:
Ignacio Fiorentino 2016-10-31 16:36:58 -03:00
parent d9149b162d
commit 9bdec5da7c
2 changed files with 19 additions and 8 deletions

View file

@ -59,6 +59,9 @@ class ClientAdmin(admin.ModelAdmin):
[_(u'Information'), {
'fields': ('contact_email', 'website_url', 'terms_url', 'logo', 'date_created'),
}],
[_(u'Session Management'), {
'fields': ('_post_logout_redirect_uris',),
}],
]
form = ClientForm
list_display = ['name', 'client_id', 'response_type', 'date_created']

View file

@ -45,6 +45,22 @@ class Client(models.Model):
logo = models.FileField(blank=True, default='', upload_to='oidc_provider/clients', verbose_name=_(u'Logo Image'))
_redirect_uris = models.TextField(default='', verbose_name=_(u'Redirect URIs'), help_text=_(u'Enter each URI on a new line.'))
def redirect_uris():
def fget(self):
return self._redirect_uris.splitlines()
def fset(self, value):
self._redirect_uris = '\n'.join(value)
return locals()
redirect_uris = property(**redirect_uris())
_post_logout_redirect_uris = models.TextField(blank=True, default='', verbose_name=_(u'Post Logout Redirect URIs'), help_text=_(u'Enter each URI on a new line.'))
def post_logout_redirect_uris():
def fget(self):
return self._post_logout_redirect_uris.splitlines()
def fset(self, value):
self._post_logout_redirect_uris = '\n'.join(value)
return locals()
post_logout_redirect_uris = property(**post_logout_redirect_uris())
class Meta:
verbose_name = _(u'Client')
@ -56,15 +72,7 @@ class Client(models.Model):
def __unicode__(self):
return self.__str__()
def redirect_uris():
def fget(self):
return self._redirect_uris.splitlines()
def fset(self, value):
self._redirect_uris = '\n'.join(value)
return locals()
redirect_uris = property(**redirect_uris())
@property
def default_redirect_uri(self):