from django.contrib import admin

from products.models import *

class ProductImageInline(admin.TabularInline):
    model = ProductImage
    extra = 0

class ProductAdmin (admin.ModelAdmin):
    list_display = [field.name for field in Product._meta.fields]
    inlines = [ProductImageInline]

    class Meta:
        model=Product

admin.site.register(Product, ProductAdmin)



class ProductCategoryAdmin(admin.ModelAdmin):
    list_display = [field.name for field in ProductCategory._meta.fields]

    class Meta:
        model = ProductCategory

admin.site.register(ProductCategory, ProductCategoryAdmin)


class ProductImageAdmin(admin.ModelAdmin):
    list_display = [field.name for field in ProductImage._meta.fields]

    class Meta:
        model = ProductImage


admin.site.register(ProductImage, ProductImageAdmin)
class ProductDateAdmin(admin.ModelAdmin):
    list_display = [field.name for field in ProductDate._meta.fields]

    class Meta:
        model =ProductDate


admin.site.register(ProductDate, ProductDateAdmin)

