apps: add link to user's table email column (#64849)
This commit is contained in:
parent
456796b024
commit
2818b86697
|
@ -24,6 +24,7 @@ from django.conf import settings
|
|||
from django.db import DEFAULT_DB_ALIAS, router
|
||||
from django.urls import reverse_lazy
|
||||
from django.utils.timezone import now, utc
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
@ -248,6 +249,8 @@ class AppConfig(django.apps.AppConfig):
|
|||
|
||||
def a2_hook_manager_modify_table(self, view, table):
|
||||
import django_tables2 as tables
|
||||
from authentic2.manager.tables import UserLinkColumn
|
||||
from django_tables2.utils import A
|
||||
|
||||
if view.__class__.__name__ == 'UsersView':
|
||||
ou = view.search_form.cleaned_data['ou']
|
||||
|
@ -273,7 +276,12 @@ class AppConfig(django.apps.AppConfig):
|
|||
else:
|
||||
del base_columns['get_full_name']
|
||||
sequence.remove('get_full_name')
|
||||
|
||||
base_columns['email'] = UserLinkColumn(
|
||||
verbose_name=_('Email'),
|
||||
args=[A('pk')],
|
||||
accessor='email',
|
||||
attrs={"td": {"class": "link"}},
|
||||
)
|
||||
table.base_columns = base_columns
|
||||
table.sequence = sequence
|
||||
table.columns = tables.columns.BoundColumns(table, base_columns)
|
||||
|
|
Loading…
Reference in New Issue