My snippet has a image field. The image is not shown in snippet admin index page.
class Product(ClusterableModel):
name = models.CharField(max_length=255)
image = models.ForeignKey(
"wagtailimages.Image",
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name="+",
)
sku = models.CharField(max_length=128)
number = models.IntegerField()
def schedule(self):
return format_html("<a>First</a> | <a>Second</a>")
panels = [
FieldPanel("name"),
FieldPanel("image"),
FieldPanel("sku"),
FieldPanel("number"),
]
def __str__(self):
return self.name
class ProductViewSet(SnippetViewSet):
model = Product
menu_icon = "pilcrow" # change as required
menu_order = 200 # will put in 3rd place (000 being 1st, 100 2nd)
add_to_admin_menu = True # or False to exclude your model from the menu
search_fields = ("name", "sku")
list_display = ("name", "sku", "image", "number", "schedule")
register_snippet(ProductViewSet)
it shows like this
example index admin page
I want to show the image itself, not the image name.
New contributor
Tom Edward is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.