diff --git a/passbook/admin/templates/administration/application/list.html b/passbook/admin/templates/administration/application/list.html index 7a5df9bd2..20be356fb 100644 --- a/passbook/admin/templates/administration/application/list.html +++ b/passbook/admin/templates/administration/application/list.html @@ -21,6 +21,7 @@
{% trans 'Name' %} | -{% trans 'Class' %} | +{% trans 'Type' %} | ||
---|---|---|---|---|
+ {% if not provider.application %} + + {% else %} + + {% endif %} + | {{ provider.name }} | -{{ provider|fieldtype }} | +{{ provider|verbose_name }} | {% trans 'Edit' %} diff --git a/passbook/admin/views/applications.py b/passbook/admin/views/applications.py index b6ba4ed4c..bf9b5eb37 100644 --- a/passbook/admin/views/applications.py +++ b/passbook/admin/views/applications.py @@ -14,6 +14,7 @@ class ApplicationListView(AdminRequiredMixin, ListView): """Show list of all applications""" model = Application + ordering = 'name' template_name = 'administration/application/list.html' def get_queryset(self): diff --git a/passbook/core/models.py b/passbook/core/models.py index db6c6816e..a8bf4b5e9 100644 --- a/passbook/core/models.py +++ b/passbook/core/models.py @@ -161,6 +161,10 @@ class Application(PolicyModel): from passbook.core.policies import PolicyEngine return PolicyEngine(self.policies.all()).for_user(user).result + def get_provider(self): + """Get casted provider instance""" + return Provider.objects.get_subclass(pk=self.provider.pk) + def __str__(self): return self.name diff --git a/passbook/lib/templatetags/utils.py b/passbook/lib/templatetags/utils.py index df2c89311..1ed90740e 100644 --- a/passbook/lib/templatetags/utils.py +++ b/passbook/lib/templatetags/utils.py @@ -207,3 +207,8 @@ def gravatar(email, size=None, rating=None): gravatar_url += '?' + urlencode(parameters, doseq=True) return escape(gravatar_url) + +@register.filter +def verbose_name(obj): + """Return Object's Verbose Name""" + return obj._meta.verbose_name diff --git a/passbook/saml_idp/models.py b/passbook/saml_idp/models.py index 18ba9ccf3..55313e081 100644 --- a/passbook/saml_idp/models.py +++ b/passbook/saml_idp/models.py @@ -40,12 +40,12 @@ class SAMLProvider(Provider): def link_download_metadata(self): """Get link to download XML metadata for admin interface""" - # pylint: disable=no-member - if self.application: + try: # pylint: disable=no-member return reverse('passbook_saml_idp:metadata_xml', kwargs={'application': self.application.slug}) - return None + except Provider.application.RelatedObjectDoesNotExist: + return None class Meta: |