diff --git a/authentik/core/api/propertymappings.py b/authentik/core/api/propertymappings.py
index 008a09d3a..af579086a 100644
--- a/authentik/core/api/propertymappings.py
+++ b/authentik/core/api/propertymappings.py
@@ -20,7 +20,6 @@ from authentik.core.api.utils import (
)
from authentik.core.expression import PropertyMappingEvaluator
from authentik.core.models import PropertyMapping
-from authentik.lib.templatetags.authentik_utils import verbose_name
from authentik.lib.utils.reflection import all_subclasses
from authentik.managed.api import ManagedSerializer
from authentik.policies.api.exec import PolicyTestSerializer
@@ -87,9 +86,10 @@ class PropertyMappingViewSet(
"""Get all creatable property-mapping types"""
data = []
for subclass in all_subclasses(self.queryset.model):
+ subclass: PropertyMapping
data.append(
{
- "name": verbose_name(subclass),
+ "name": subclass._meta.verbose_name,
"description": subclass.__doc__,
"component": subclass.component,
}
diff --git a/authentik/core/api/providers.py b/authentik/core/api/providers.py
index 7108dce0b..6e549c04c 100644
--- a/authentik/core/api/providers.py
+++ b/authentik/core/api/providers.py
@@ -11,7 +11,6 @@ from rest_framework.viewsets import GenericViewSet
from authentik.core.api.utils import MetaNameSerializer, TypeCreateSerializer
from authentik.core.models import Provider
-from authentik.lib.templatetags.authentik_utils import verbose_name
from authentik.lib.utils.reflection import all_subclasses
@@ -73,9 +72,10 @@ class ProviderViewSet(
"""Get all creatable provider types"""
data = []
for subclass in all_subclasses(self.queryset.model):
+ subclass: Provider
data.append(
{
- "name": verbose_name(subclass),
+ "name": subclass._meta.verbose_name,
"description": subclass.__doc__,
"component": subclass().component,
}
diff --git a/authentik/core/api/sources.py b/authentik/core/api/sources.py
index da1070fb4..a113d686f 100644
--- a/authentik/core/api/sources.py
+++ b/authentik/core/api/sources.py
@@ -13,7 +13,6 @@ from structlog.stdlib import get_logger
from authentik.core.api.utils import MetaNameSerializer, TypeCreateSerializer
from authentik.core.models import Source
from authentik.core.types import UserSettingSerializer
-from authentik.lib.templatetags.authentik_utils import verbose_name
from authentik.lib.utils.reflection import all_subclasses
from authentik.policies.engine import PolicyEngine
@@ -67,9 +66,11 @@ class SourceViewSet(
"""Get all creatable source types"""
data = []
for subclass in all_subclasses(self.queryset.model):
+ subclass: Source
+ # pyright: reportGeneralTypeIssues=false
data.append(
{
- "name": verbose_name(subclass),
+ "name": subclass._meta.verbose_name,
"description": subclass.__doc__,
"component": subclass().component,
}
diff --git a/authentik/core/templates/base/skeleton.html b/authentik/core/templates/base/skeleton.html
index 4c47e0476..b28a9fa68 100644
--- a/authentik/core/templates/base/skeleton.html
+++ b/authentik/core/templates/base/skeleton.html
@@ -1,6 +1,5 @@
{% load static %}
{% load i18n %}
-{% load authentik_utils %}
diff --git a/authentik/core/templates/error/generic.html b/authentik/core/templates/error/generic.html
index 5ef6538bd..a6bf253e0 100644
--- a/authentik/core/templates/error/generic.html
+++ b/authentik/core/templates/error/generic.html
@@ -1,7 +1,6 @@
{% extends 'base/skeleton.html' %}
{% load i18n %}
-{% load authentik_utils %}
{% block head %}
{{ block.super }}
diff --git a/authentik/core/templates/login/base_full.html b/authentik/core/templates/login/base_full.html
index 450a969c4..2e2854f73 100644
--- a/authentik/core/templates/login/base_full.html
+++ b/authentik/core/templates/login/base_full.html
@@ -2,7 +2,6 @@
{% load static %}
{% load i18n %}
-{% load authentik_utils %}
{% block body %}
diff --git a/authentik/flows/api/stages.py b/authentik/flows/api/stages.py
index 8e188487c..4d89cb19b 100644
--- a/authentik/flows/api/stages.py
+++ b/authentik/flows/api/stages.py
@@ -14,7 +14,6 @@ from authentik.core.api.utils import MetaNameSerializer, TypeCreateSerializer
from authentik.core.types import UserSettingSerializer
from authentik.flows.api.flows import FlowSerializer
from authentik.flows.models import Stage
-from authentik.lib.templatetags.authentik_utils import verbose_name
from authentik.lib.utils.reflection import all_subclasses
LOGGER = get_logger()
@@ -68,9 +67,10 @@ class StageViewSet(
"""Get all creatable stage types"""
data = []
for subclass in all_subclasses(self.queryset.model, False):
+ subclass: Stage
data.append(
{
- "name": verbose_name(subclass),
+ "name": subclass._meta.verbose_name,
"description": subclass.__doc__,
"component": subclass().component,
}
diff --git a/authentik/lib/templatetags/__init__.py b/authentik/lib/templatetags/__init__.py
deleted file mode 100644
index e69de29bb..000000000
diff --git a/authentik/lib/templatetags/authentik_utils.py b/authentik/lib/templatetags/authentik_utils.py
deleted file mode 100644
index a23e59dbc..000000000
--- a/authentik/lib/templatetags/authentik_utils.py
+++ /dev/null
@@ -1,40 +0,0 @@
-"""authentik lib Templatetags"""
-
-from django import template
-from django.db.models import Model
-from structlog.stdlib import get_logger
-
-register = template.Library()
-LOGGER = get_logger()
-
-
-@register.filter("fieldtype")
-def fieldtype(field):
- """Return classname"""
- if isinstance(field.__class__, Model) or issubclass(field.__class__, Model):
- return verbose_name(field)
- return field.__class__.__name__
-
-
-@register.filter(name="css_class")
-def css_class(field, css):
- """Add css class to form field"""
- return field.as_widget(attrs={"class": css})
-
-
-@register.filter
-def verbose_name(obj) -> str:
- """Return Object's Verbose Name"""
- if not obj:
- return ""
- if hasattr(obj, "verbose_name"):
- return obj.verbose_name
- return obj._meta.verbose_name
-
-
-@register.filter
-def form_verbose_name(obj) -> str:
- """Return ModelForm's Object's Verbose Name"""
- if not obj:
- return ""
- return verbose_name(obj._meta.model)
diff --git a/authentik/outposts/api/outpost_service_connections.py b/authentik/outposts/api/outpost_service_connections.py
index e19f644fb..4c121f610 100644
--- a/authentik/outposts/api/outpost_service_connections.py
+++ b/authentik/outposts/api/outpost_service_connections.py
@@ -19,7 +19,6 @@ from authentik.core.api.utils import (
PassiveSerializer,
TypeCreateSerializer,
)
-from authentik.lib.templatetags.authentik_utils import verbose_name
from authentik.lib.utils.reflection import all_subclasses
from authentik.outposts.models import (
DockerServiceConnection,
@@ -76,9 +75,11 @@ class ServiceConnectionViewSet(
"""Get all creatable service connection types"""
data = []
for subclass in all_subclasses(self.queryset.model):
+ subclass: OutpostServiceConnection
+ # pyright: reportGeneralTypeIssues=false
data.append(
{
- "name": verbose_name(subclass),
+ "name": subclass._meta.verbose_name,
"description": subclass.__doc__,
"component": subclass().component,
}
diff --git a/authentik/policies/api/policies.py b/authentik/policies/api/policies.py
index ab7fdcff2..7cde0b361 100644
--- a/authentik/policies/api/policies.py
+++ b/authentik/policies/api/policies.py
@@ -18,7 +18,6 @@ from authentik.core.api.utils import (
MetaNameSerializer,
TypeCreateSerializer,
)
-from authentik.lib.templatetags.authentik_utils import verbose_name
from authentik.lib.utils.reflection import all_subclasses
from authentik.policies.api.exec import PolicyTestResultSerializer, PolicyTestSerializer
from authentik.policies.models import Policy, PolicyBinding
@@ -100,9 +99,10 @@ class PolicyViewSet(
"""Get all creatable policy types"""
data = []
for subclass in all_subclasses(self.queryset.model):
+ subclass: Policy
data.append(
{
- "name": verbose_name(subclass),
+ "name": subclass._meta.verbose_name,
"description": subclass.__doc__,
"component": subclass().component,
}
diff --git a/authentik/policies/templates/policies/denied.html b/authentik/policies/templates/policies/denied.html
index eb942e7c6..aa6b08095 100644
--- a/authentik/policies/templates/policies/denied.html
+++ b/authentik/policies/templates/policies/denied.html
@@ -2,7 +2,6 @@
{% load static %}
{% load i18n %}
-{% load authentik_utils %}
{% block card_title %}
{% trans 'Permission denied' %}
diff --git a/authentik/providers/oauth2/templates/providers/oauth2/end_session.html b/authentik/providers/oauth2/templates/providers/oauth2/end_session.html
index a71cd59c4..acf5936d5 100644
--- a/authentik/providers/oauth2/templates/providers/oauth2/end_session.html
+++ b/authentik/providers/oauth2/templates/providers/oauth2/end_session.html
@@ -2,7 +2,6 @@
{% load static %}
{% load i18n %}
-{% load authentik_utils %}
{% block head %}
{{ block.super }}
diff --git a/authentik/stages/email/templates/email/password_reset.html b/authentik/stages/email/templates/email/password_reset.html
index 3d6659ad4..d83a0cee1 100644
--- a/authentik/stages/email/templates/email/password_reset.html
+++ b/authentik/stages/email/templates/email/password_reset.html
@@ -1,6 +1,5 @@
{% extends "email/base.html" %}
-{% load authentik_utils %}
{% load i18n %}
{% load humanize %}