Add some more failsafe for administration

This commit is contained in:
Jens Langhammer 2019-03-07 14:09:52 +01:00
parent 4991e9b825
commit 99c82676b6
3 changed files with 7 additions and 1 deletions

View File

@ -157,6 +157,8 @@ class Application(PolicyModel):
def get_provider(self):
"""Get casted provider instance"""
if not self.provider:
return None
return Provider.objects.get_subclass(pk=self.provider.pk)
def __str__(self):

View File

@ -29,7 +29,7 @@
<div class="login-pf-page">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12 col-md-8 col-md-offset-2 col-lg-4 col-lg-offset-4">
<div class="col-sm-12 col-md-8 col-md-offset-2 col-lg-6 col-lg-offset-3">
<header class="login-pf-page-header">
<img class="login-pf-brand" style="max-height: 10rem;" src="{% static 'img/logo.svg' %}"
alt="passbook logo" />

View File

@ -212,10 +212,14 @@ def gravatar(email, size=None, rating=None):
@register.filter
def verbose_name(obj):
"""Return Object's Verbose Name"""
if not obj:
return ''
return obj._meta.verbose_name
@register.filter
def form_verbose_name(obj):
"""Return ModelForm's Object's Verbose Name"""
if not obj:
return ''
return obj._meta.model._meta.verbose_name