from django.contrib import admin
from django.utils.safestring import mark_safe
from .models import Product

# Register your models here.
class ProductAdmin(admin.ModelAdmin):
    list_display = ("name", "price", "stock", "image_tag")

    def image_tag(self, obj):
        if obj.image:
            return mark_safe(
                '<img src="%s" style="width: 45px; height:45px;" />' % obj.image.url
            )
        else:
            return "No Image Found"


admin.site.register(Product, ProductAdmin)

96801bcecb3fef90e35e97f8be92bdf512f31e52
<mask token>


class ProductAdmin(admin.ModelAdmin):
    <mask token>

    def image_tag(self, obj):
        if obj.image:
            return mark_safe(
                '<img src="%s" style="width: 45px; height:45px;" />' % obj.
                image.url)
        else:
            return 'No Image Found'


<mask token>

<mask token>


class ProductAdmin(admin.ModelAdmin):
    list_display = 'name', 'price', 'stock', 'image_tag'

    def image_tag(self, obj):
        if obj.image:
            return mark_safe(
                '<img src="%s" style="width: 45px; height:45px;" />' % obj.
                image.url)
        else:
            return 'No Image Found'


<mask token>

<mask token>


class ProductAdmin(admin.ModelAdmin):
    list_display = 'name', 'price', 'stock', 'image_tag'

    def image_tag(self, obj):
        if obj.image:
            return mark_safe(
                '<img src="%s" style="width: 45px; height:45px;" />' % obj.
                image.url)
        else:
            return 'No Image Found'


admin.site.register(Product, ProductAdmin)

from django.contrib import admin
from django.utils.safestring import mark_safe
from .models import Product


class ProductAdmin(admin.ModelAdmin):
    list_display = 'name', 'price', 'stock', 'image_tag'

    def image_tag(self, obj):
        if obj.image:
            return mark_safe(
                '<img src="%s" style="width: 45px; height:45px;" />' % obj.
                image.url)
        else:
            return 'No Image Found'


admin.site.register(Product, ProductAdmin)

from django.contrib import admin
from django.utils.safestring import mark_safe
from .models import Product

# Register your models here.
class ProductAdmin(admin.ModelAdmin):
    list_display = ("name", "price", "stock", "image_tag")

    def image_tag(self, obj):
        if obj.image:
            return mark_safe(
                '<img src="%s" style="width: 45px; height:45px;" />' % obj.image.url
            )
        else:
            return "No Image Found"


admin.site.register(Product, ProductAdmin)
