mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Introduce ContentTypesColumn for custom field and webhook tables
This commit is contained in:
@@ -12,6 +12,8 @@ from django_tables2.data import TableQuerysetData
|
||||
from django_tables2.utils import Accessor
|
||||
|
||||
from extras.models import CustomField
|
||||
from extras.utils import FeatureQuery
|
||||
from .utils import content_type_name
|
||||
from .paginator import EnhancedPaginator, get_paginate_count
|
||||
|
||||
|
||||
@@ -235,12 +237,20 @@ class ContentTypeColumn(tables.Column):
|
||||
Display a ContentType instance.
|
||||
"""
|
||||
def render(self, value):
|
||||
return value.name[0].upper() + value.name[1:]
|
||||
return content_type_name(value)
|
||||
|
||||
def value(self, value):
|
||||
return f"{value.app_label}.{value.model}"
|
||||
|
||||
|
||||
class ContentTypesColumn(tables.ManyToManyColumn):
|
||||
"""
|
||||
Display a list of ContentType instances.
|
||||
"""
|
||||
def transform(self, obj):
|
||||
return content_type_name(obj)
|
||||
|
||||
|
||||
class ColorColumn(tables.Column):
|
||||
"""
|
||||
Display a color (#RRGGBB).
|
||||
|
Reference in New Issue
Block a user