Skip to content

Commit

Permalink
Add icon class and image to service and type admin lists
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnyunar committed Jan 26, 2025
1 parent 8712f7d commit 1bfe54b
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions registry/admin.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from adminsortable2.admin import SortableAdminMixin
from django.contrib import admin
from django.forms import IntegerField
from django.utils.translation import gettext_lazy as _
from unfold.admin import TabularInline, ModelAdmin
from unfold.forms import ActionForm
from unfold.widgets import UnfoldAdminIntegerFieldWidget
Expand Down Expand Up @@ -56,7 +57,8 @@ class ServiceAdmin(ModelAdmin):
"name",
"website",
"rating",
"created_at",
"icon_class",
"has_image",
"updated_at",
"is_active",
)
Expand All @@ -65,6 +67,10 @@ class ServiceAdmin(ModelAdmin):
inlines = [ServiceURLInline, ServiceInfoInline]
prepopulated_fields = {"slug": ("name",)}

@admin.display(boolean=True, description=_("Has Image"))
def has_image(self, obj):
return bool(obj.image)


@admin.register(ServiceURL)
class ServiceURLAdmin(ModelAdmin):
Expand All @@ -76,7 +82,7 @@ class ServiceURLAdmin(ModelAdmin):

@admin.register(ServiceInfoType)
class ServiceInfoTypeAdmin(ModelAdmin):
list_display = ("name", "created_at", "updated_at")
list_display = ("name", "icon_class", "updated_at")
search_fields = ("name",)
ordering = ("name",)

Expand Down

0 comments on commit 1bfe54b

Please sign in to comment.