from django.contrib import admin
from .models import Product, WishlistItem


@admin.register(WishlistItem)
class WishlistItemAdmin(admin.ModelAdmin):
    list_display = ('user', 'product', 'created_at')
    search_fields = ('user__username', 'product__name')


@admin.register(Product)
class ProductAdmin(admin.ModelAdmin):
    list_display = ('name', 'category', 'price', 'created_at') if hasattr(Product, 'price') else ('name',)
    list_filter = ('category', 'featured')
    exclude = ('listing_type', 'rental_price', 'rent_duration')
    search_fields = ('name', 'description') if hasattr(Product, 'description') else ('name',)
