fixes for idea render and other
This commit is contained in:
@@ -354,13 +354,19 @@ class SectorInline(TabularInline):
|
||||
|
||||
def get_keywords_count(self, obj):
|
||||
if obj.pk:
|
||||
return getattr(obj, 'keywords_set', obj.keywords_set).count()
|
||||
try:
|
||||
return obj.keywords_set.count()
|
||||
except (AttributeError, Exception):
|
||||
return 0
|
||||
return 0
|
||||
get_keywords_count.short_description = 'Keywords'
|
||||
|
||||
def get_clusters_count(self, obj):
|
||||
if obj.pk:
|
||||
return getattr(obj, 'clusters_set', obj.clusters_set).count()
|
||||
try:
|
||||
return obj.clusters_set.count()
|
||||
except (AttributeError, Exception):
|
||||
return 0
|
||||
return 0
|
||||
get_clusters_count.short_description = 'Clusters'
|
||||
|
||||
@@ -404,8 +410,8 @@ class SiteAdmin(ExportMixin, AccountAdminMixin, Igny8ModelAdmin):
|
||||
|
||||
def get_api_key_display(self, obj):
|
||||
"""Display API key with copy button"""
|
||||
from django.utils.html import format_html
|
||||
if obj.wp_api_key:
|
||||
from django.utils.html import format_html
|
||||
return format_html(
|
||||
'<div style="display:flex; align-items:center; gap:10px;">'
|
||||
'<code style="background:#f0f0f0; padding:5px 10px; border-radius:3px;">{}</code>'
|
||||
|
||||
Reference in New Issue
Block a user